Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4746

Best way to use USART/HSERIN

$
0
0
I'm working on a project where there will be one PIC as a master controller to adjust LED brightness & motor control. I want to link this master PIC to the motor/LED chips via USART in a chain (all by wire on a PCB - no other components involved) and send the mode/speed changes down using a hard-coded ID; each chip down the line will check the ID and if it matches it's own then it acts on it, else it just passes it down the line.

My question is this - how best to set up HSERIN in a situation like this? Should I use something like this in a Main loop:

Code:

Main:
    HserIN [WAIT("OK"),ID]
    IF ID="3" THEN
        gosub updateLEDs
    ELSE
        HserOUT [data]
    ENDIF

    goto Main

Or would it be better to use Darrel's Instant Interrupts with the Rx interrupt?

This will be my first time using HSERIN/HSEROUT apart from using it for LCD debugging.

Viewing all articles
Browse latest Browse all 4746

Trending Articles