Ummm, Why 8 bytes?
If the idea was to store more users in the limited EEPROM space, and you don't need to have other security settings per user. Why not have a 5 byte record size? That's a 60% increase in users. 51 vs 32. (assuming 256 EEPROM)
<br>
Ummm, Why 8 bytes?
If the idea was to store more users in the limited EEPROM space, and you don't need to have other security settings per user. Why not have a 5 byte record size? That's a 60% increase in users. 51 vs 32. (assuming 256 EEPROM)
<br>
DT
Hi again Darrel,
All that stuff worked a treat. Thanks.
Now there is a follow up to that series.
Now that I am getting 5 bytes to play with, I am simply generating a 4 digit decimal code by taking the last numeral from each of the bytes (decimalised) ((along the lines of dec1 card(1) dec1 card(2) dec1 card(3) dec1 card(4)))
This works fine, as long as I am sending these numerals out serially or sending to an LCD. What I am having trouble with is sending the bottom half of the decimal byte to a port. The byte should be %0000xxxx where xxxx is the decimal 0 - 9 in binary. Right so far??
It seems to me that I can't qualify the byte as dec1, BIN4 or anything like that when I am not sending it to the port. I have tried portb = var AND %00001111 which to my way of thinking should mask off the top nibble but what I get out of the port is a full byte of 1's with no resemblance to the numeral that can be deciphered at all.
I got a few other things to try, so I'll be back.
I'll have a look at BCD and see if I can make that work.
Last edited by muddy0409; - 10th January 2007 at 17:17. Reason: more info added
What you need is the Bitwise operators "&" + "|" (OR).
Since you only want to output the lower bits of PORTB, you have to read PORTB first, mask out the lower bits, then OR the new bits in.
portb = (portb & %11110000) | (var & %00001111)
<br>
DT
Hi Darrel,
I've been up all nite trying to sort this thing out. Let's see if I can explain where I am ATM:
I've got 5 bytes coming in as 5 hex2 numbers.
I am taking the low nibble of each of those as hex1 numerals.
Gotta then convert then to dec1 digits and write them to port b low nibble.
I think I've got it sorted...
I don't think I will need to read, mask, or, then write portb as there is a set sequence that needs following, but that will be another problem, probably.
I just gotta write the low nibble with the high nibble all 0's and then do some bit manipulation with the high nibble. Should be pretty easy.
Famous last words huh?
Im not sure if this is what you need but, it is a simple Ascii to hex converter. This assumes the stringbyte is limited to valid hex characters.
ConvertAscii_to_Hex:
StringByte = StringByte - 48
Lookup StringByte, ( 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,10,11,12,13,14,15) , Returnbyte
Return
Rightyo, thanks for all the help blokes. I got it all sorted out.
It may not be pretty, but it works a treat.
And it fits in the codespace.
Peter Moritz.
Up the bush, Western Plains,
New South Wales,
Australia.
Bookmarks