It is for the software uart.Hi,
I've been searching for clues!
Does this help [ SERIN_TIMEOUT_BIT ] ?
C.
It is for the software uart.Hi,
I've been searching for clues!
Does this help [ SERIN_TIMEOUT_BIT ] ?
C.
Hi J,It is for the software uart.
Ok, no good for this then.Hi J,
.
Hi E,hi,
Use the Tools.Break point manager, to locate which part of the program is hanging.
Then post that section of code.
E
Serin_Timeout_Bit is only used with the software UART implementation, not the hardware (HSERIN). From the serial UART code I've written in Oshonsoft, there is no easy way to control the hardware UART unless you use register flags and/or interrupts, not the HSERxxx commands themselves (specifically HSERIN). You still use HSEROPEN statement to set up the baud rate and registersHi,
I've been searching for clues!
Does this help [ SERIN_TIMEOUT_BIT ] ?
C.
I would check the RX buffer bit first, to verify there is a character to "GET", before reading it. HSERGET will return a zero immediately if there is no character. If there is a character in the RX buffer, it will return that character. Do the read over and over until it returns a zero.Hi
I've been testing HSERGET in SIM MODE.instead of HSERIN.
I could see that [ rxi ] counts up at each pass, so the incoming [ CHARS ] weren't put in the correct [ STR1 ] slot.
So HSERGET may work, I'll have to come back to it later. (Remind me)
C.
Hi E,hi,
This is sim in my PC.
What is the purpose is the Wait command.?
Don't waste program processing time.
E
Hi S,Camera, looking at one section of your code, you increment "rxi" but never check if it overflows past 79. If, for some reason, you get more data than you expect, you will possibly crash the program when you overflow STR1.
nxt_rxin:
If str1(0) = "$" Then
WaitMs 15 '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Hserget char
If char = "?" Or char = 0x0a Then Goto msg_eol
str1(rxi) = char
rxi = rxi + 1
Goto nxt_rxin
Hi S,In your code:
Hserget will return a zero if no character has been received yet. If your loop is fast, it will fill your string with lots of zero characters. You have to filter those out in that loop, or check the receive register for the flag saying there is something in the buffer. Do not do a HSERGET if there is nothing in the receive buffer, there is no point. You have to control the flow of the serial data, and always check validity of each character you get (or filter).Code:nxt_rxin: If str1(0) = "$" Then WaitMs 15 '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Hserget char If char = "?" Or char = 0x0a Then Goto msg_eol str1(rxi) = char rxi = rxi + 1 Goto nxt_rxin
PS Hserin will read anything, based on the variables in the line. It can read a single character, or an entire string of characters, depending on what you ask it to read. Hserget is just a character "read the receive buffer", regardless if there is anything in it or not.
Hi E,hi C,
Am I correct in assuming that the full/total program is in one 18F4620, that is reading incoming data, is also controlling the PWM.etc ... ??
E