The HSerGetString looks very promising, and I have an application where I send a serial command to a device, it will respond with 10 bytes of data that I want to decipher later using left, right, mid, instr, etc. The sending of the data is working perfect so no problem there. The 10 bytes of characters that come back are something like
FF 12 1C 6F 34 2C EE F2 19 AA
with no spaces, just 10 bytes of data. There is no CR or LF after this string, just straight up 10 bytes. I was trying to find the source for the HSerGetString sub so I could maybe do a bit of changing to it to handle this. I didn't want to use an interrupt driven setup because, I can control when the pic should listen for this string. I want to listen to the serial RX and grab the 10 bytes only when commanded to do so. Since there is no CR or LF, I thought maybe the HSerGetString sub could be modified with a counter to only grab the 10 bytes when told to.
So is this possible, and where can I find the actual code used for the HSerGetString sub. I looked in the lowlevel and elsewhere, but to no avail.
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
#define USART_BAUD_RATE 9600
#Define USART_BLOCKING
'tell unit to send me 10 byte string then get it here...
RecString = ""
For XX = 1 to 10
GetOne = HSerReceive1
RecString = RecString + GetOne
Next XX
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HserGetString is in /Lowlevel/usart.h , You need to be running the latest version of GCB, (.97.01)
However I would suggest you do not change or modify it in the lowlevel USART.h file. Instead use a redirect in your source code.
Find the HserGetString routine in usart.h and copy it to your GCB source file, Then rename it MyHSerGetString. Then add the redirect line in your Source Code
#define HserGetString MyHSerGetString
Now when you call HserGetString it will actually call MyHSerGetString. You can then modify your new routine as much as you want without changing the lowlevel code.
Last edit: William Roth 2017-03-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The HSerGetString looks very promising, and I have an application where I send a serial command to a device, it will respond with 10 bytes of data that I want to decipher later using left, right, mid, instr, etc. The sending of the data is working perfect so no problem there. The 10 bytes of characters that come back are something like
FF 12 1C 6F 34 2C EE F2 19 AA
with no spaces, just 10 bytes of data. There is no CR or LF after this string, just straight up 10 bytes. I was trying to find the source for the HSerGetString sub so I could maybe do a bit of changing to it to handle this. I didn't want to use an interrupt driven setup because, I can control when the pic should listen for this string. I want to listen to the serial RX and grab the 10 bytes only when commanded to do so. Since there is no CR or LF, I thought maybe the HSerGetString sub could be modified with a counter to only grab the 10 bytes when told to.
So is this possible, and where can I find the actual code used for the HSerGetString sub. I looked in the lowlevel and elsewhere, but to no avail.
Thanks!
or is it as simple as something like this...
HserGetString is in /Lowlevel/usart.h , You need to be running the latest version of GCB, (.97.01)
However I would suggest you do not change or modify it in the lowlevel USART.h file. Instead use a redirect in your source code.
Find the HserGetString routine in usart.h and copy it to your GCB source file, Then rename it MyHSerGetString. Then add the redirect line in your Source Code
Now when you call HserGetString it will actually call MyHSerGetString. You can then modify your new routine as much as you want without changing the lowlevel code.
Last edit: William Roth 2017-03-14