Looks like your syntax is the problem.
It waits for whatever is in the []Code:serin PortB.1,t9600,[ADRESS],databyte
You are coded more for SERIN2
What 485 converter are you using?
Looks like your syntax is the problem.
It waits for whatever is in the []Code:serin PortB.1,t9600,[ADRESS],databyte
You are coded more for SERIN2
What 485 converter are you using?
Dave
Always wear safety glasses while programming.
Sorry, thats my mistake
It was originally a serin2 command..
But it's about waiting for one qualifier OR the other i'm trying to implement.
It should store the recieved byte once the slave's individual adress (qualifier 1) or the broadcast adress (qualifier 2) is forfilled.
Maybe i should just divide it up in two different commands..
Thank you
The RS485 Tranciever i am using is the TI SN65HVD06D 1/8 Load, 10Mbps
http://focus.ti.com/lit/ds/symlink/sn65hvd06.pdf
'Instead of waiting, grab the first byte and see if it's for your ID or Broadcast then
'if so collect the rest of the bytes
HSerIn Timeout,ExitRx,[BufRX(0)]
If ((BufRx[0] = MyID) or (BufRx[0] = BroadCast)) then
For Cnt = 1 to 7
HSerIn Timeout,ExitRx,[BufRX(Cnt)]
Next Cnt
EndIf
WAIT actually has to look at each byte as well in order to know weather to start storing or not.
You can use Skinner's technique which is easy enough or consider this.
If your command sequence is terminated with a known value like CR or CRLF which is the norm in most cases, your job becomes easier. What you have to do is just collect the data and buffer it till you hit the CR. Then, check the packet for ID and process accordingly. This is how I do it in my products
ID xxxx CR
If the packet is not yours and not a broadcast, discard it.
Yes, but if he is doing something like modbus for instance, he only has the node#, correct number of bytes to collect, and then the timeout or Silent time.
Then he would have to verify the data with a crc check before proceding, this of course is if he is using MB RTU and Not ASCII, or his own home grown protocol.
Only reason I menioned modbus is because he mentioned a 485 network, Node ID, and Broadcast so it kind of sounds like it.
Richard
Bookmarks