|
|
View previous topic :: View next topic |
Author |
Message |
erpgc82
Joined: 02 May 2020 Posts: 73
|
|
Posted: Sat Jul 10, 2021 8:46 pm |
|
|
Ttelmah wrote: | OK. Typed the code in. Two mistakes. I'd left out the 16 on a variable name,
and added 10 not subtracted it:
Code: |
int8 hexval(int8 chr)
{
if (chr>='0' && chr<='9')
return chr-'0'; //value is digit minus 48
if (chr>='A' && chr<='F')
return chr-('A'-10); //value here is digit minus 55
return 0;//invalid character
}
void convertHexDec(void)
{
unsigned int16 result16=0;
unsigned int8 result8=0;
int digit;
if ((!card_reader)&&(!barcode))
{
for (digit=5;digit<7;digit++) //first two nibbles
{
result8*=16;
result8+=hexval(rfidcod_buffer[digit]);
}
for (digit=7;digit<11;digit++) //now the next four nibbles
{
result16*=16;
result16+=hexval(rfidcod_buffer[digit]);
}
//for each digit, convert the hex ASCII character to a numeric
//value, add to the result. Repeat for each digit, multiplying
//the total by 16 as we go.
decRFID16 = result16;
if (rfid8_16)
decRFID8 = result8;
}
}
|
This is tested and works.
Sounds as if you move forwards. |
Hello friends, especially Mr Ttelmah, I managed to make the RDM6300 work without replicating the readings, without "gags"... I'm happy!
I continued with my terribly fledgling conversion function.
I didn't make any changes to the interrupt either!
And the duplicate read check I did on the interrupt, as below:
Code: |
#INT_RDA2
void serial_isr()
{
int;
buffer[next_in]=fgetc(READER);
if((buffer[next_in]==0x02)&&(!barcode)) countRFID++;
if((buffer[next_in]==0x03)&&(!barcode)) read_card=FALSE;
t=next_in;
next_in=(next_in+1)%BUFFER_SIZE;
if(next_in==next_out) next_in=t;
}
|
Problem solved!
Anyway, thanks so much for the tips! _________________ Gradually you will go far with persistence, will and determination! |
|
|
erpgc82
Joined: 02 May 2020 Posts: 73
|
last doubt |
Posted: Sat Jul 10, 2021 8:50 pm |
|
|
just one last question, because in this previous post, you informed me that my work frequency setting is incorrect?
I'm not working at 64Mhz then?
there are some little faults. For example:
setup_oscillator(OSC_64MHZ|OSC_PLL_OFF);
The OSC_PLL_OFF here actually does nothing. A good thing really, since
64MHz, _requires_ the PLL to be on. Get rid of this.
I believe I have correctly done the account for the configuration, and got 25ms on Timer0 overflow. So much so that I get the correct times...
_________________ Gradually you will go far with persistence, will and determination! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19605
|
|
Posted: Sun Jul 11, 2021 7:49 am |
|
|
The point was the OSC_PLL_OFF, was being ignored by the compiler.
It was an incorrect setting, and the compiler (correctly), was just ignoring
it...
It should not be there.
setup_oscillator(OSC_64MHZ);
Is the correct setting.
So the 'setting', is incorrect. However because of the way the setting
works, the 'OSC_PLL_OFF' part was just being ignored. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|