Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20562

Share your working BASCOM-AVR code here : IR NEC Code generation : REPLY

$
0
0
Hi, because of the String conversion i wanted to try to do it without great conversions... didn't test it by now, but this might be shorter and without dim string... [code:1:ba11022b11] '------------------------------------------------------------------------------ ' NEC_out_short.bas DJ7DA / 16.7.13 '------------------------------------------------------------------------------ $regfile = "m8def.dat" $crystal = 8000000 ' internal RC osc. $hwstack = 32 $swstack = 32 $framesize = 32 $baud = 9600 ' for command input '------------------------------------------------------------------------------ Config Portd = Output ' free choice Portd.5 = 1 ' NEC data out Const Address = "1111111100000000" ' 0 = TV Address Dim Out_dword As Dword , B As Byte , Key# As Byte '------------------------ Main --------------------------------------------- Do Inputbin Key# ' via serial port Out_dword = Address Shift Out_dword , Left , 8 Out_dword = Out_dword Or Key# Shift Out_dword , Left , 8 Key# = Not Key# Out_dword = Out_dword Or Key# Shift Out_dword , Left , 8 'Startpuls Pulseout Portd , 5 , 18000 : Waitus 4500 ' Startpulse (18000 = 9 ms) For B = 31 To 0 Step -1 Pulseout Portd , 5 , 1125 If Out_dword.b = 0 Then Waitus 562 Else Waitus 1686 End If Next Pulseout Portd , 5 , 1125 ' Stoppulse Waitms 250 Loop ' next entry End [/code:1:ba11022b11]

Viewing all articles
Browse latest Browse all 20562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>