View previous topic :: View next topic |
Author |
Message |
shahram
Joined: 04 May 2009 Posts: 2
|
SCPI(Standard Command for Programmable Instruments) |
Posted: Mon May 04, 2009 5:22 am |
|
|
Hi,
Has anyone written a SCPI (Standard Commands for Programmable Instruments??) for a PIC here?
Thanks |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Mon May 04, 2009 7:06 am |
|
|
A search shows one mention back in Feb 2008. Looking at the specs, it seems to be pretty straightforward and not very difficult to implement. |
|
|
Guest
|
|
Posted: Tue May 05, 2009 1:21 pm |
|
|
I have - unfortunately I cannot share the code. Basically it is simple to parse, but takes a bit of string manipulation code.
Use strtok() to separate the commands (command groups are separated by ':')
Then search for matches to the long and short form of the commands in a string table that you make up that has all the commands.
You just loop through these down the command tree until the final match is found.
Remember that strtok() is not re-entrant - as it remembers what you did last. So usually I have to build several different versions of strtok() (with different names) so that I don't disturb the parsing that is going on above in the command tree.
If I can do it, then heck anyone can as I am basically a Analog / RF hardware engineer... So don't worry!
;-)
HTH - Steve H. |
|
|
shahram
Joined: 04 May 2009 Posts: 2
|
|
Posted: Sat May 09, 2009 10:35 pm |
|
|
Thanks a lot, i am also a bio-electric engineer, but i will try to do that. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
|
Steve H Guest
|
|
Posted: Sun May 10, 2009 11:57 am |
|
|
Jpac soft makes a PC parser, but there is a lot of info on their website. This parser simply won't work on a PIC - it was meant for a PC. But it is very well done - If I was writing on an embedded PC That's what I would use!
Also you can try the scpi consortium for info on how the commands are supposed to work.
Personally - I have always just looked at how others implemented their commands - always try to stick with something that works - like Dave suggested.
HTH - Steve H |
|
|
|