LouisG Senior Member
 Joined: 19/03/2016 Location: AustraliaPosts: 130 |
| Posted: 03:45am 04 Jan 2023 |
|
|
|
Hi guys,
I'm a MicroMite veteran who is having his first crack at a PicoMite.
My project is to operate 24 relays from a PicoMite, singly or in combination, using an IR remote signal. Pins used will be GP0 to GP23 for the relays, GP24 for the IR receiver. Outputs will be into optocouplers with 1K series resistors.
I built breadboard versions of the IR Tx and Rx. The trial IR Tx works, successfully sending Device code = 1 and Key code = 2 on powerup.
The IR Receive breadboard follows the example in the PicoMite manual 5.07.05, page 30, and with the 9 lines of example code loaded it displayed the above two codes on the console accurately. However, when I added SETPIN code for setting up the 24 digital output pins the receiver stopped receiving the IR codes. See code below.
DIM INTEGER Relay(24)=(-1,1,2,4,5,6,7,9,10,11,12,14,15,16,17,19,20,21,22,24,25,26,27,29,31) FOR i = 1 to 24 : SETPIN (Relay(i)),DOUT : NEXT
DIM INTEGER DevCode, KeyCode SETPIN 32, IR IR DevCode, KeyCode, IRInt
DO PAUSE 1000 LOOP
SUB IRInt PRINT "Received device = " DevCode " Key = " KeyCode END SUB
If I delete or comment out the FOR...NEXT statement in Line 2, the IR code is accurately received, as displayed on the console.
If I leave the FOR...NEXT in, the IR code is not received (although the 24 outputs are properly set to DOUT).
I need both! What am I doing wrong? Any help would be appreciated.
Louis |