Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language EPICS

(EPICS database using SynApps)

Date:07/08/06
Author:Andreas Luedeke
URL:n/a
Comments:1
Info:http://www.aps.anl.gov/epics/
Score: (3.00 in 32 votes)
record(calcout,"songsinger") {
  field(SCAN,"5 second")
  field(DESC,"Main record")
  field(INPA,"bottlecount")
  field(CALC,"A>0?A+1:0")
  field(OOPT,"When Non-zero")
  field(OCAL,"A-1")
  field(DOPT,"Use OCAL")
  field(OUT,"bottlecount PP")
}
record(ai,"bottlecount") {
  field(FLNK,"textseq PP")
}
record(scalcout,"bottleline") {
  field(AA," bottles")
  field(BB,"1 bottle")
  field(CC,"no more bottles")
  field(CALC,"(A>1)?(PRINTF('%i',A)+AA):(A?BB:CC)")
}
record(calc,"bottlecount-1") {
  field(INPA,"bottlecount NPP")
  field(CALC,"A>0?A-1:99")
}
record(seq,"textseq") {
  field(DOL1,"bottlecount NPP")
  field(LNK1,"bottleline.A PP")
  field(DLY1,"0.1")
  field(DO2,"1")
  field(LNK2,"textline1.B PP")
  field(DLY2,"0.1")
  field(DO3,"0")
  field(LNK3,"textline1.B PP")
  field(DLY3,"0.1")
  field(DOL4,"bottlecount-1 PP")
  field(LNK4,"bottleline.A PP")
  field(DLY4,"2.1")
  field(DOL5,"bottlecount NPP")
  field(LNK5,"textline2a.A PP")
  field(DLY5,"0.1")
  field(DOL6,"bottlecount-1 NPP")
  field(LNK6,"textline2b.A PP")
  field(DLY6,"0.1")
  field(LNK7,"linefeed PP")
  field(DLY7,"0.1")
}
record(scalcout,"textline1") {
  field(INPA,"bottlecount.VAL NPP")
  field(INAA,"bottleline.SVAL")
  field(CC," of beer on the wall,")
  field(DD," of beer.")
  field(CALC,"AA+(B?CC:DD)")
  field(OUT,"printer CPP")
}
record(scalcout,"textline2a") {
  field(INPA,"bottlecount.VAL NPP")
  field(AA,"Take one down and pass it around, ")
  field(BB,"Go to the store and buy some more, ")
  field(CALC,"A?AA:BB")
  field(OUT,"printer CPP")
}
record(scalcout,"textline2b") {
  field(INPA,"bottlecount.VAL NPP")
  field(INAA,"bottleline.SVAL PP")
  field(BB," of beer on the wall.")
  field(CALC,"AA+BB")
  field(OUT,"printer CPP")
}
record(scalcout,"linefeed") {
  field(CALC,"")
  field(OUT,"printer CPP")
}
record(stringin,"printer") {
}

Download Source | Write Comment

Alternative Versions

Comments

>>  Andreas Luedeke said on 07/12/06 16:24:06

Andreas Luedeke The documentation got lost: like always ;-)

How to sing "99-bottles of beer" with EPICS:
- download and compile an ioc-shell with the SynApps package
- load the above database to this ioc-shell
- monitor the stringin PV "printer"
- write the desired number of bottles (99) to the PV "bottlecount"

Each line of the song is written in a timed sequence to the "printer".

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: