Discussion in "8051 Discussion Forum" started by    marai    Aug 5, 2008.
Tue Aug 05 2008, 02:54 AM
Hi..i'm kinda new with 8051 uC, really unfamiliar. Still in the process of learning here
Ii was given a task to continue the project of my previous batch.

He build a board that will send repetition command to a card, which will do write,erase and check the checksum of the card. Number of reps is entered by user and stored in 41h and 42h.

He included the counting by decrementing the value in 41h n 42h, value of remaining count will display if there is error to the card. The problem is that it is never done completely. The value shown is wrong. I had no idea to debug his prog anymore..

My friend suggested to add a counter circuit. Can someone develop a counter hardware n program in assembly? I want to add the line in existing program so that after finished the routine and loop again, it will give one bit and the external counter will increment the number and display current count. Number of repetition can be up to FFh*FFh=65025decimal.

The board is using AT89s51, most of the port is used. So my idea is, maybe p 2.3 can go to some external circuit and do task like explained above..

Maybe can use LCD or anything that can display number...

Or any idea to solve this prob is helping too...i'm really stuck here

Thank you in advance

[ Edited Tue Aug 05 2008, 02:55 AM ]
Tue Aug 05 2008, 12:06 PM
may i see your program and circuit, it will be easy to help you then.
Tue Aug 05 2008, 08:39 PM
thanks ajay for replying

here's the program. as for schematic i'll send it later because i've stored it in my pendrive, but unfortunately broken yesterday...i'll get it somehow.

the problem is in endurance mode only. so you maybe can focus on that particular part. it cannot display the remaining count in case of failure <-- which is when checksum value not as defined.

Thank you
Thu Aug 07 2008, 08:19 PM
hi ajay,

here is the schematic

so maybe if can use one bit from the uC to send out signal each time looping is complete to external counter circuit shud be fine.

is it possible?

Fri Aug 08 2008, 03:04 AM
pins from port2 is free you can use it.. just make that pin low when you enter into the time loop and make it high while coming out. so evertime a cycle is complete you will get a low to high pulse.

You code is really big and is in assembly so need time to read
 marai like this.
Sun Aug 10 2008, 08:08 PM
thanks ajay for trying...really appreciate if you can help

maybe debugging is too much complex...is there external counter circuit using LCD which can be used for this? it seems like a better idea though. it detects when the bits goes up and display counting at LCD. can you do that?

thanks in advance ^_^

[ Edited Sun Aug 10 2008, 08:44 PM ]
Mon Aug 11 2008, 04:01 AM
can you tell me an overview of your program will be easier to help you out

and i am sorry i dont have enough time for counter program, you can make it urself its really simple. just connect the counter input to interrupt and whenever interrupt occurs increment a count and display it.
Mon Aug 11 2008, 05:32 AM
this program originaly not written by me. its from a friend who already moved to other place.

from main program, it will initialize lcd, and few others.

next it will go to keypad to detect the input. numbers at keypad is already set for certain routine. this routine will send apdu to card.

i will concentrate on the endurance routine. from endurance, it will et x and y values from count_program.asm. values is stored at address defined in program. then branched to count_start at count_program.asm..

from here program will send write38k and checksum then erase then checksum again. it will loop for X*Y times via djnz. if all count is completed lcd will display success (located in lcd_program.asm)

the problem is when error or when number of loop not finished as entered, LCD should display remaining count. program will jmp to 'stop'. But count displayed is wrong, e.g - always display 0202 even though remaining count should be much more.

or when card removed, it does not jump to stop but straight to main and reques insert apdu. :mad

i've give up doing that. so thats why thought of external counter. hmm,

so for the counter, when input is high it will encrement. then the value is stored in some registry. so does it work by mov value in acc, then add the value, then transfer value to LCD?

i'm sorry, i'm totally new with asembly. trying to learn by searching the net bit by bit

Tags input numbersbit by bitendurancecount program
Mon Aug 11 2008, 07:01 AM
so that means you just need to check that loop where the problem might be happening.

asm makes everything difficult, understanding and debugging both
Mon Aug 11 2008, 07:37 AM
yah..i understand that. thing seems more complex than anything can be =.=

kinda give up checking the code..can you advice where i should start to build the counter circuit?

Get Social


Powered by e107 Forum System


Wed May 20 2020, 03:59 AM
Does anyone have microcontroller programming software for STC15F104W (core 8051, 4 k, 128 byte, 6 I/O pin, UART ... DIL8), that works?
Sun May 03 2020, 01:08 AM
Tamu Gurung
Hi I am looking for a assembly language program for a digital decimal counter. Time counts max limit of 2 mins starting from 2.00 mins and ending at 0.00. time is to be displayed on 4 7-segment LED displays. Edsim51 simulator to be used. Thanks
Wed Mar 25 2020, 07:09 PM
Sir kindly send the code file i2c for 8051
Sat Mar 14 2020, 04:06 AM
@ Rohitnani,ABEBE..which project ?
Fri Mar 13 2020, 06:25 PM
how can get hadwere of this project
Sat Mar 07 2020, 09:41 PM
Sir, Could you please send me the zip file input password....
Wed Feb 26 2020, 09:28 PM
Peter Parker
Is it possible to send multiple messages using only 1 GSM module?
Sat Feb 01 2020, 02:42 PM
Pearl Olin
Wed Jan 22 2020, 10:46 PM
I m getting errors while simulation process during interfacing socket output and lcd... Can i get the report of ur project which is same as us.
Tue Jan 14 2020, 11:38 AM
shubham kharade
when i am trying to simulate the program in Proteus 8 professional, I am getting some errors as cannot find module file dhtxx.md can u help me



Thu May 21 2020, 08:44 AM
Wed May 20 2020, 09:28 PM
Wed May 20 2020, 03:05 PM
Wed May 20 2020, 07:52 AM
Wed May 20 2020, 03:15 AM
Tue May 19 2020, 06:08 PM
Tue May 19 2020, 02:22 PM
Mon May 18 2020, 09:50 PM


Guests: 41, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 01:37 AM

Members: 38211
Newest member: Davidthils
Forum Activity
xrxx Avatar
Posted By xrxx
Thu Apr 30 2020, 06:59 AM
BCD MULTIPLICATIONAssume that you have to 2 BCD nu...
liqian Avatar
Posted By liqian
Tue Apr 28 2020, 05:26 AM
I happened to see your post and I got many useful ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Apr 28 2020, 04:21 AM
The code is hard to read.Please zip it and attach ...
rogermado Avatar
Posted By rogermado
Sun Apr 26 2020, 01:53 AM
@ExperimenterUK, thanks for your reply. You'll fin...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Apr 25 2020, 05:42 PM
Some simulators handle displays better than others...
rogermado Avatar
Posted By rogermado
Sat Apr 25 2020, 03:59 PM
Hello everyone, sorry in advance if i'm not in the...
PHANTOM28 Avatar
Posted By PHANTOM28
Fri Feb 28 2020, 10:25 AM
Hi.I hope you all can help me. I am relatively ne...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Feb 21 2020, 05:05 PM
ajay_bhargav Avatar
Posted By ajay_bhargav
Fri Feb 21 2020, 04:45 AM
Yes you can do that.1. Create a channel @Thingspea...
ananyagupta Avatar
Posted By ananyagupta
Thu Feb 20 2020, 03:58 AM
With regards to the particular characters sent to ...