Discussion in "8051 Discussion Forum" started by    marai    Aug 5, 2008.
Tue Aug 05 2008, 12:24 pm
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, 12:25 pm ]
Tue Aug 05 2008, 09:36 pm
may i see your program and circuit, it will be easy to help you then.
Wed Aug 06 2008, 06:09 am
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
Fri Aug 08 2008, 05:49 am
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, 12:34 pm
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.
Mon Aug 11 2008, 05:38 am
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 Mon Aug 11 2008, 06:14 am ]
Mon Aug 11 2008, 01:31 pm
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, 03:02 pm
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, 04:31 pm
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, 05:07 pm
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



Mon Apr 22 2024, 03:50 pm
Mon Apr 22 2024, 06:38 am
Sun Apr 21 2024, 07:39 pm
Sun Apr 21 2024, 06:30 pm
Sun Apr 21 2024, 02:45 am
Sat Apr 20 2024, 11:05 am
Fri Apr 19 2024, 09:59 pm
Fri Apr 19 2024, 02:51 pm