Discussion in "8051 Discussion Forum" started by    marai    Aug 5, 2008.
Tue Aug 05 2008, 06:54 AM
#1
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, 06:55 AM ]
Tue Aug 05 2008, 04:06 PM
#2
may i see your program and circuit, it will be easy to help you then.
Wed Aug 06 2008, 12:39 AM
#3
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, 12:19 AM
#4
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, 07:04 AM
#5
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, 12:08 AM
#6
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, 12:44 AM ]
Mon Aug 11 2008, 08:01 AM
#7
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, 09:32 AM
#8
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, 11:01 AM
#9
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, 11:37 AM
#10
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

Information

Powered by e107 Forum System

Conversation

Mon Jan 25 2021, 04:53 PM
Geraldsup
AccStores
Mon Jan 25 2021, 03:17 PM
hbqbvidliw
zmajjtynyi
Mon Jan 25 2021, 03:13 PM
gcfnmuvdrf
xyxzydekxw
Mon Jan 25 2021, 03:11 PM
ylrxnvvpuc
voadyxrmqh
Mon Jan 25 2021, 03:09 PM
tgediqtdhc
agtxjrbbju

Downloads

Comments

Mirza123
Thu Jun 25 2020, 03:46 PM
eunicelove124
Mon Jun 22 2020, 03:03 PM
cerouno
Tue Jun 16 2020, 05:10 PM
Marce
Sat Jun 13 2020, 09:43 PM
Davidthils
Thu May 21 2020, 12:44 PM
Jakeror
Thu May 21 2020, 01:28 AM
motorCar
Wed May 20 2020, 07:05 PM
Vordrync
Wed May 20 2020, 11:52 AM

Online

Guests: 96, Members: 0 ...

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

Members: 38215
Newest member: Mirza123