Init(J1708,...)
Description
Initializes J1708 interface for monitoring/reading (J1708 only to be used for reading purposes)
Syntax
Init(J1708, speed, word_length, stop_bits, parity);
Parameters
Variable | Input |
|---|---|
| This is serial port data transfer speed in bit/s. Speed (baud rate) can be one of the following: 9600 |
| This is data size in bits. For example: WORDLENGTH_7 - 7 bit long data packet. Can be: WORDLENGTH_7, WORDLENGTH_8 or WORDLENGTH_9 |
| This number of bits that shows end of a single packet. Can be: STOPBITS_1 or STOPBITS_2 |
| Parity is error detection bit, which show that data is made out of even or odd number of ones. Parity is either - PARITY_NONE, PARITY_EVEN, PARITY_ODD |
Returns
Return value | Return explanation |
SCRIPT_OPERATION_SUCCESS | Success |
SCRIPT_NO_ACCESS | Peripheral already initialized. |
Function call example
J1708 initialization example
new string[50];
main(){
Init(J1708, 9600, WORDLENGTH_8, STOPBITS_1, PARITY_NONE);
while(1){
read_buf(J1708, 6, string); //read some data. See read_buf documentation for more detail
Delay(100);
}
}
Notes and Warnings
J1708 only to be used for reading purposes.