The code appears to work correctly (please see attached files codepicture).· Even though -1 does work, it's probably better to use serie.start(31, 30, 0, 9600).· That's the only change I made, but it did work either way.· It takes 10 seconds for the serial terminal to start displaying information because of waitcnt(clkfreq*10 + cnt).· Make sure your terminal is set for baud rate = 9600 bps.
Comments
CON _xinfreq = 5_000_000 _clkmode = xtal1 | pll16x OBJ serie:"FullDuplexSerialPlus" PUB inicio serie.start(-1,30,0,9600) DirA[noparse][[/noparse]13]:=0 'Patita del sensor magnetico configurada como entrada dira[noparse][[/noparse]16]:=1 'LED Verde del sensor magnetico waitcnt(clkfreq*10 + cnt) repeat if(InA[noparse][[/noparse]13]==0) serie.str(String("Entra en IF")) waitcnt(12_000_000 + cnt) outa[noparse][[/noparse]16] := 1 ' Enciende el LED (n) waitcnt(clkfreq*2 + cnt) elseif(InA[noparse][[/noparse]13]==1) serie.str(String("Entra en ELSEIF")) waitcnt(12_000_000 + cnt) outa[noparse][[/noparse]16] := 0 ' Apaga el LED (n) waitcnt(clkfreq*2 + cnt) serie.stop
The code appears to work correctly (please see attached files code picture).· Even though -1 does work, it's probably better to use serie.start(31, 30, 0, 9600).· That's the only change I made, but it did work either way.· It takes 10 seconds for the serial terminal to start displaying information because of waitcnt(clkfreq*10 + cnt).· Make sure your terminal is set for baud rate = 9600 bps.
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.