' ====================================================================== ' ' File...... test1.pbas ' Purpose... ' Author.... ' E-mail.... ' Started... ' Updated... ' ' ====================================================================== ' ---------------------------------------------------------------------- ' Program Description ' ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- ' Device Settings ' ---------------------------------------------------------------------- DEVICE P8X32A, XTAL1, PLL16X XIN 5_000_000 ' ---------------------------------------------------------------------- ' Constants ' ---------------------------------------------------------------------- Baud CON "T115200" HOME CON 1 BKSP CON 8 TAB CON 9 LF CON 10 CLREOL CON 11 CLRDN CON 12 CR CON 13 CLS CON 16 ' ---------------------------------------------------------------------- ' I/O Pins ' ---------------------------------------------------------------------- TX PIN 30 HIGH LED PIN 16 LOW ' ---------------------------------------------------------------------- ' Shared (hub) Variables (Byte, Word, Long) ' ---------------------------------------------------------------------- alpha VAR Long ' ---------------------------------------------------------------------- ' Shared (hub) Data (DATA, WDATA, LDATA, FILE) ' ---------------------------------------------------------------------- ' ---------------------------------------------------------------------- ' TASK Definitions ' ---------------------------------------------------------------------- ' ---------------------------------------------------------------------- ' Cog Variables (Long only) ' ---------------------------------------------------------------------- ' ---------------------------------------------------------------------- ' SUB/FUNC Definitions ' ---------------------------------------------------------------------- TX_BYTE SUB 2 ' shell for SEROUT DELAY_MS SUB 1 ' shell for PAUSE ' ====================================================================== PROGRAM Start ' ====================================================================== Start: DELAY_MS 10 ' TX idle for 10ms TX_BYTE TX, CLS Main: DO FOR alpha = "A" TO "Z" TOGGLE LED TX_BYTE TX, alpha DELAY_MS 50 NEXT TX_BYTE TX, CR LOOP END ' ---------------------------------------------------------------------- ' SUB/FUNC Code ' ---------------------------------------------------------------------- SUB TX_BYTE SEROUT __param1, Baud, __param2 ENDSUB ' ---------------------------------------------------------------------- SUB DELAY_MS PAUSE __param1 ENDSUB ' ---------------------------------------------------------------------- ' TASK Code ' ----------------------------------------------------------------------