Csub NECSend for the PicoMite


Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3321
Posted: 07:44am 22 Mar 2024      

Updated PicoMite version of NECsend, just a few minor tweaks.
Sub NECsend IRout As integer, dev As integer, key As integer
'Picomite V5.08.00 version
Local integer word, d(2066), m, n = 1

word = (dev<<16) + (key<<8) + 255-key '32bit word = Device 16b + Key 8b + inverted Key 8b

Math set 13, d() 'fill array with half-cycles, 13uS = duration of a half cycle @ 38kHz
d(691) = 4500  'uS pause after 9mS of 38kHz to start

For m = 733 To 2065 Step 42  'load data after start sequence
 d(m) = (((word>>(32-n)) And 1)*2 + 1) * 562.5'convert bits to pauses (0=562uS, 1=1687uS)
 Inc n 'step to next data bit
Next

Device bitstream IRout, 2066, d() 'send the data

Pin(IRout) = 0
End Sub