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

BASCOM-AVR : Filling byte arrays : REPLY

$
0
0
[quote:99d2a3d7e3="sidknox"]Horrible code? Well, I won't dispute that...[/quote:99d2a3d7e3] You [b:99d2a3d7e3]can't[/b:99d2a3d7e3] dispute that :D [quote:99d2a3d7e3]I am not a programmer, I am a hardware guy that writes code to make the hardware work.[/quote:99d2a3d7e3] Doesn't matter, there's always a way to improve and advance. [quote:99d2a3d7e3]at the rather simple level at which I code[/quote:99d2a3d7e3] Don't put the bar too low... [quote:99d2a3d7e3]I suspect that if you saw the whole thing that it would cause cardiac arrest.[/quote:99d2a3d7e3] Guess so. But as I don't want to hand out only blame, here's some code to chew on: [code:1:99d2a3d7e3]$Regfile = "m328def.dat" $Crystal = 4000000 $hwstack = 40 $swstack = 16 $framesize = 32 Const lentgh_tlgrm = 9 ' length in bytes of one telegram Dim charTM(lentgh_tlgrm) As Byte ' temporary array Dim bytTMchar As Byte ' index to telegram Dim char_ctr As Byte ' counter for filling the array Dim idx As Word ' variable to hold the absolute index within the data block bytTMchar = 1 ' index for testing idx = bytTMchar * lentgh_tlgrm For char_ctr = 1 To lentgh_tlgrm charTM(char_ctr) = Lookup(idx , tlgrm_data) ' fill byte by byte of the temporary array Incr idx Next char_ctr End tlgrm_data: Data &H00 , &H00 , &H00 , &H10 , &H00 , &H00 , &H02 , &H0D , &H00 Data &H00 , &H00 , &H01 , &H54 , &HAA , &HA5 , &H77 , &H77 , &H77 ' ...[/code:1:99d2a3d7e3]

Viewing all articles
Browse latest Browse all 20610

Trending Articles