5.28. RANDOM


Performs one iteration of pseudo-randomization on Var. Var must be a 16-bit variable. (NOTE: PBC does not support the use of the PORT variable with the RANDOM statement). The pseudo-random algorithm used has a walking length of 65535 (only zero is not produced).

Random W4 'Get a random number to W4


5.29. READ

READ Address, Var

Reads the EEPROM at the specified Address and stores the result in Var. If Address is 255, Var is assigned the number of EEPROM bytes available. This instruction may only be used with a PICmicro MCU that has an on-chip EEPROM data area such as the PIC16C84 or PIC16F84.

Read 5,B2 'Put the value at EEPROM location 5 into B2


5.30. RETURN


Returns from subroutine. RETURN resumes execution at the statement following the GOSUB which called the subroutine.

Gosub sub1


'Go to subroutine labeled sub1
sub1: Serout 0,N2400,("Lunch") 'Send "Lunch" out Pin0 serially
Return 'Return to main program after Gosub




If the pin is an input, it is made an output. If the pin is an output, it is made an input. Pins are numbered 0 to 7.

Output 4 'Make Pin4 an output
Reverse 4 'Change Pin4 to an input