Hello,
I stared to be frustrated from the fact, that my 16F648 doesn't work at 4 Mhz clock speed with HSERIN/HSEROUT commands.
Please see this code:
DEFINE OSC 20
'hserin definition
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_BAUD 115200
DEFINE HSER_CLROERR 1
while 1
if (PIR1.5==1) then
goSUB manageSerialByte
endif
wend
end
manageSerialByte:
HSERIN 1,Jump,[SERIALBYTE]
If SERIALBYTE = "p" Then
HSEROUT ["hello",10]
end if
Jump:
return
This code is working perfectly, please see that OSC is 20 and I am using 20Mhz crystal resonator.
But due to the fact, that I want to operate the circuit on 3V, I need to use 4Mhz crystal and OSC 4.
So only what I did in my code I changed the first line:
DEFINE OSC 4
But I cannot manage to make serin and serout working. And the controller is working, because I am using in the code tmr0 interrupt, which is blinking LED and the LED is blinking, it means, that the PIC is working and processing the code, but the problem is, that this SERIN/SEROUT simply not work!!!
Thanks for feedback, what do you think about this strange problem...
Bookmarks