Hi All,
I sure appreciate that you all were willing to look at my question. I got the first response from skimask, and it prompted me to throw myself at the wall again and see if I could find the door. At some point, you feel that you have explored it to the limits of your ability, but you have to try again. I slowed down and tried to remember advise that I had gotten here by reading through anything that seemed relevant. I could send some data, so send registers to see where they were before they locked or corrupted. That started to reveal some interesting things that didn't have obvious answers.
By adding the last part to these lines:
hserout ["Cmd: ",DEC SerialData," ",BIN3 STATE]
I was able to see that there was a "13" being sent (Line Feed). Hmmmm....
Looking at MicroCode Studio Serial Communicatior's transmit window: A right click opens a selection
window. an option is there for Line Terminator where you can select CR, CR+LF, Null,or NO
terminator. Guess I found my "13" and why nothing was showing until I added DEC to see it.
Further testing is showing that I'm throwing a ONERR even though "DEFINE HSER_CLOERR 1" is in there.
Added "RXbyte = RCREG" to read the receive register but I still get the overrun.
Tried 2400 baud, still acts the same.
tried setting DT's Instant Interrupts macro to ResetFlag = yes: still over-runs the buffer.
Why is it that 20 quick "A"s or "U"s don't over-run the buffer and any data does?
Just as a way to check some of the questions, I closed Communicator and tried talking to it with RealTerm. I'll be darned if that didn't clear things right up. Evidently, after cleaning up a bit, it actually works!
I'm going to look carefully at your feedback and incorporate it, but I wanted to show what I have working so far:
Code:
hserout ["start"] 'splash screen to verify comm
HSEROUT [10,13] ' CR to start new line on terminal program
Mainloop:
for holdoff = 1 to 500
pause 1
next holdoff
led0count = led0count + 1
led0 = led0count.0 'toggle led every loop for heartbeat
goto Mainloop
'*********** 'ISR for RX_int interrupt ***************************************
Getbytes:
While RCIF = 1 ' clear the buffer
HSERIN 100,error,[Serialdata] ' Get serial
led2count = led2count + 1 ' Incr heartbeat
Wend
led2 = led2count.0 'led to confirm program went to RX ISR
if SerialData = "U" then GoodSync 'must have good sync: 01010101
if SerialData = "=" then GoodaDR 'BROADCAST address to all units
if SerialData = ID then GoodAdr 'unique address for each slave
if state = %00000011 then GoodCmd 'good sync and address(ID)
addr = 0 'If not Sync & ID, clr addr good flag
@ INT_RETURN
GoodSync:
sync = 1 'set sync good flag
hserout ["Sync: ",SerialData]
HSEROUT [10,13] 'Carriage Return
@ INT_RETURN
GoodAdr:
addr = 1 'got a good address
hserout ["Adr: ",SerialData]
hserout [10,13]
@ INT_RETURN
GoodCmd:
cmd = 1
CmdBuf = SerialData
hserout ["Cmd: ",SerialData," ",DEC CmdBuf]'send Command and CR
HSEROUT [10,13]
addr = 0 'reset the address verification
CMD = 0 'reset the command received flag
@ INT_RETURN
Well I am going back into non-internet land for the day, so I'll update after I get back.
Again. I can't thank you and the list enough. I strive not to be a "code-sucker" but there really is a lot of stuff that can trip you up and a lot of tiny things that will frustrate you greatly. Think of it as raising the next generation of question answerers ;-)
Bo
Bookmarks