Does anyone know how to use HSEROUT to talk to PLX-DAQ? I am getting a RX from PLX-DAQ
but apparently my format is wrong or maybe it just doesn't work with a PIC.
Thanks, Don
Does anyone know how to use HSEROUT to talk to PLX-DAQ? I am getting a RX from PLX-DAQ
but apparently my format is wrong or maybe it just doesn't work with a PIC.
Thanks, Don
Hi Don,
I have not tried using that, but others have been successful. Here is one thread that talks a little about it.
http://www.picbasic.co.uk/forum/showthread.php?t=13564
http://www.scalerobotics.com
There really is no code just the defines and HSEROUT. Bare minimum. It connects and I can see the little green box with the "R" in it flash red when I reset the pic. I can receive no problem with hyperterminal and the terminal in Microcode Studio. I have used Debug and Hserout2 with those two with no problems. I think it might be a format issue.
Well, this is from their help file. You probably already saw it though. Hserout should work, as long as it is set up correctly.
(8 bits, no parity, 1 stop bit)
PLX-DAQ Directives
PLX-DAQ analyzes incoming data strings from the controller for action. Strings begin with a directive informing PLX-DAQ of what action to take.
- All directives are in CAPITAL letters, and some are followed by comma-separated data. Each string MUST end in a carriage return (CR).
- Strings not beginning with directives will be ignored.
- Note that the BASIC Stamp's DEBUG instruction is used in the following discussion.
Control and Data Directives BASIC Stamp Example Usage DATA, value1, value2,...
Stores the data into the next row from column A on.Up to 26 comma values may be sent. The 1st value will be placed in column A, the 26th in column Z.
DEBUG "DATA,", DEC Val1, ",", DEC Val2, CR Special: The strings TIME, TIMER and DATE in value positions 1 and 2 will cause PLX-DAQ to replace those strings with the current time (TIME) or the time in seconds since opening or the last timer reset (TIMER), and date when using the DATA directive.
DEBUG "DATA, TIME, TIMER,", DEC Val1,",",DEC Val2,CR
LABEL, label 1, label 2, label 3,...
Labels the columns from A up to Z. Row 1 is used for labels, up to 26 labels may be sent.
DEBUG "Time, Timer, Value 1, Value 2", CR CLEARDATA
Clears columns A-J of data from Row 2 on (labels remain in Row 1), or the number of columns to which data was being posted.DEBUG "CLEARDATA",CR RESETTIMER
Resets the when using the TIMER directive to place the time in seconds into the cell.DEBUG "RESETTIMER",CR MSG, message string
Places a message in the PLX-DAQ Controller Message box. Do not use commas in the message string.
DEBUG "MSG, Starting data run.",CR
Interactive Directives BASIC Stamp Example Usage ROW,GET
Retrieves the last row number data was placed into using the DATA directive.
DEBUG "ROW,GET",CR ' Request row
DEBUGIN DEC row ' Accept row value into variable
or
SEROUT 16,84,["ROW,GET",CR] ' Request Row
SERIN 16,84,500,Timeout,[DEC row] ' Accept row value with timeout
Timeout:ROW,SET,Value
Sets the row number to use for next DATADEBUG "ROW,SET,2",CR ' Send next data to row 2 CELL,GET,cellnum
Retrieves the value in a specified cell.DEBUG "CELL,GET,A4",CR ' Request cell value
DEBUGIN DEC cellval ' Accept cell value into variable
or
SEROUT 16,84,["CELL,GET,A4",CR] ' Request cell
SERIN 16,84,500,Timeout,[DEC cellval] ' Accept cell value with timeout
Timeout: Note: variables and constants may be used for cells in the A-F range by using hexadecimal.
Cell CON $A4
DEBUG "CELL,GET,", HEX CELL,CR
CELL,SET,cellnum,cellvalue
Sets the specified cell value or textDEBUG "CELL,SET,B4,Hello!",CR
DEBUG "CELL,SET,B5,", DEC x, CR
Note: variables and constants may be used for cells in the A-F range by using hexadecimal. See CELL,GET.DOWNLOAD,GET
STORED,GET
USER1,GET
USER2,GET
Reads the status of one of the four checkboxes
on the PLX-DAQ interface.
0 for unchecked
1 for checked.DEBUG "USER1,GET",CR ' Request checkbox value
DEBUGIN DEC check1 ' Accept value into variable
IF check1 = 1 Then ...
or
SEROUT 16,84,["USER1,GET",CR] ' Request cell
SERIN 16,84,500,Timeout,[DEC check1] ' Accept cell value with timeout
Timeout:DOWNLOAD,SET, 0 or 1
STORED,SET, 0 or 1
USER1,SET, 0 or 1
USER2,SET, 0 or 1
Sets the status of one of the four checkboxes
on the PLX-DAQ interface.
0 for unchecked
1 for checked.DEBUG "USER1,SET,1",CR ' Sets checkbox USER1 to 1 DOWNLOAD,LABEL,text
STORED,LABEL,text
USER1,LABEL,text
USER2,LABEL,text
Sets the text of the checkboxesDEBUG "USER2,LABEL,Check me!",CR ' Sets USER2 checkbox label.
BASIC Stamp Code
BASIC Stamp code is used to illustrate using the Simple Data with Plotting sheet of PLX-DAQ.
- This program sends the value of variable X and the BASIC Stamp SIN value of X.
SEROUT sPin,Baud,["DATA,TIME,TIMER,", DEC X, ",", SDEC SIN X, CR]- The current row is read, and when exceed, will reset the row back to 2.
SEROUT sPin,Baud,["ROW,GET",CR] ' Request Row
SERIN sPin, Baud,200,TimeOut,[DEC Row] ' Accept returning data with timeout
IF Row >= 300 THEN SEROUT sPin,Baud,["ROW,SET,2",CR] ' If Row is or exceeds 300, set row back to 2
- Note that SEROUT 16,84 (sPin and Baud values) is used to send data. This is equivalent to DEBUG but prevent the DEBUG window opening.
- SERIN 16,84 is used, which is equivalent to DEBUGIN, but provides for timeouts to be used so that the program does not lock up if there is a problem.
- When using the DATA directive to send multiple values, a combination of strings and values is needed to force commas between values.
http://www.scalerobotics.com
Maybe they really mean CR ??Each string MUST end in a carriage return (CR)
Dave
Always wear safety glasses while programming.
Yeah but typewriter are so hard to find theses days
Not sure they have some SMD one?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I don't think hello is a directive.
Maybe something like:PLX-DAQ Directives
PLX-DAQ analyzes incoming data strings from the controller for action. Strings begin with a directive informing PLX-DAQ of what action to take.
- All directives are in CAPITAL letters, and some are followed by comma-separated data. Each string MUST end in a carriage return (CR).
- Strings not beginning with directives will be ignored.
- Note that the BASIC Stamp's DEBUG instruction is used in the following discussion.
HSEROUT ["DATA,","1,","2,","3",13]
or:
HSEROUT ["DATA,",DEC x,",",DEC y,",",DEC z,13]
Those will show in different columns. If you want more rows, then more like their basic stamp example.
http://www.scalerobotics.com
Did the basic stamp send in True or Inverted mode?
Dave
Always wear safety glasses while programming.
Good point Dave,
The Basic Stamp sends it out as true, but it is done on the BS2 programming port, which has a max232 equivalent, so it can be read from the computer side. Since Don said he could read it in hyperterminal, I assume he is using a max232 device. I also assume he meant he tested hyperterminal with hserout. So maybe it is just in the wrong format.
From another page in the help file:
So maybe this is the hang up?
- Strings not beginning with directives will be ignored.
It would be great to see a solution, and write up in the Wiki area (Hint, Hint).
Walter
http://www.scalerobotics.com
FYI
I got it working ok except I haven't been able to send back to the PIC yet.
Thanks Walter....
Code:HSEROUT ["LABEL",",","Don's",",","Test",13] PAUSE 10 Loop: FOR x = 1 to 5 HSEROUT ["DATA",",","Hello",",","World",",","Goodbye",13] PAUSE 5000 NEXT x PAUSE 10000 HSEROUT ["CLEARDATA",13] GOTO Loop END
Last edited by ScaleRobotics; - 31st January 2011 at 20:52. Reason: added code tags
Bookmarks