How To
- Use the Watchdog and sleep
- Store non volatile information
- Copy/initialise an array
Set up UART1 on the BV500
The UART consists of an output TX and an input RX and there is a choice of pins can that they can be mapped to. The table is in rookie, for TX the peripheral is called U1TX$ and this can be mapped to RA0, RB3, RB4, RB15 and RB7.
The input TX pin is U1RX (no $) and this can be mapped to RA2, RA4, RB2, RB6 and RB13.
The following example will set up UART1 on RA0 and RA2. If you joint RA0 and RA2 together the check() function will print out "fred"
// ***************************************************************************** // Set up UART1 TX = RA0 and RX = RA2 // ***************************************************************************** function set_uart1(baud) comopen(1,baud,80) // still need to open com port pps_in(?U1RX, ?PRA2) // set rx pps_out(?PRA0, ?U1TX$) endf function check() comouts(1,"fred") wait(1) // time needed for buffer to fill while comkey?(1) <> 0 print chr$(comkey(1)) wend endf