|
Program Block Compiler Examples
These are Hercules Program Block examples to show how the Events/Library Functions can be used. They assume that particular protocols are being used with particular messages and Gryphon configurations. It is not recommended that you cut and paste this into your code because the Gryphon configuration and protocols available may be different on your particular unit. This is just to serve as an example of how operations are performed in general. Note: All of the examples shown below are contained in the all-pbec.zip file as '.psf' files and '.out' files. Editing should only be done from within the Hercules Program Block Editor. Do not use the sample code in each 'TXT' example. PrintCANFrame.psf This Program Block example provides action for multiple events, including OnError, OnStart, OnFrame,OnTimer, OnTrigger and OnKey. The example will print out a CAN frame when it occurs on the bus. It will write an error message to the screen when an Error occurs on the bus. In addition,
If 'A' is pressed send out a message on channels 1,2 & 3,
Display 'PrintCANFrame' example code AnoKeyFrm.psf This Program Block example creates two Standard CAN Frames. When the 'A' key is pressed; the speed will be increased if it is less than 90, the rpm is increased if it is less than or equal to 20, and the DataFrames are transmitted. When the 'B' key is pressed; the speed will be decreased if it is greater than or equal to 17, the rpm is decreased if it is greater than or equal to 4, and the DataFrames are transmitted.
Display 'AnoKeyFrm' example code
Encode_Decode_Data_OnKey.psf This Program Block example makes use of Encode and Decode data. Press 'I' to encode the data, value is set to 1. Decodes the data and is displayed in the Information View window. Press 'K' to display data in the Information View window. Loops 5 times and increments the 4th data byte by 5.
Display 'Encode_Decode_Data_OnKey' example code
hbcccanbridge.psf This Program Block example takes A CAN Message from one channel and change it to an SCP message and send out on the SCP channel.
Display 'hbcccanbridge' example code
std_c_and_functions.psf This Program Block example shows how to use standard c code and includes Structs, Arrays, pointers, abs(), string functions.
Display 'std_c_and_functions' example code
|
