Author |
Message |
edu001 Regular Member
 Joined: 14/07/2014 Location: United KingdomPosts: 82 |
Posted: 09:44pm 28 Jul 2014 |
Copy link to clipboard |
 Print this post |
|
Hi
I have built this array which is the decimal output of DATA I need to loop through it applying BIN$ and print the result
5000 DIM A(45)
5001 DATA &H00, &HB5, &H62, &H06, &H24, &H24, &H00, &HFF, &HFF, &H06, &H03, &H00, &H00, &H00, &H00, &H10, &H27, &H00, &H00, &H05, &H00, &HFA, &H00, &HFA, &H00, &H64, &H00, &H2C
5002 DATA &H01, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H16, &HDC
5010 FOR I = 1 TO 45
5020 READ A(I)
5030 next I
5042 print ; (BIN$(A(8)))
5200 PRINT ; "DONE UBX > Count: ";I
5300 RETURN
Line 5042 does give the correct output for A(1) to A(45)
I have tried various options I must be missing something it always fails |
|
MM_Wombat Senior Member
 Joined: 12/12/2011 Location: AustraliaPosts: 139 |
Posted: 11:11pm 28 Jul 2014 |
Copy link to clipboard |
 Print this post |
|
5000 DIM A(45)
5001 DATA &H00, &HB5, &H62, &H06, &H24, &H24, &H00, &HFF, &HFF, &H06, &H03, &H00, &H00, &H00, &H00, &H10, &H27, &H00, &H00, &H05, &H00, &HFA, &H00, &HFA, &H00, &H64, &H00, &H2C
5002 DATA &H01, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H16, &HDC
5010 FOR I = 1 TO 45
5020 READ A(I)
5030 print ; BIN$(A(I))
5042 next I
5200 PRINT ; "DONE UBX > Count: ";I
5300 RETURN
I think the print function would run better if it was inside the for..next loop, and the function was set to return the base 2 of the array item, instead of always A(8).
Was it always returning 11111111 ?
AussieWombat Keep plugging away, it is fun learning
But can be expensive (if you keep blowing things up).
Maximite, ColourMaximite, MM+
|
|
VK2MCT Senior Member
 Joined: 30/03/2012 Location: AustraliaPosts: 120 |
Posted: 11:25pm 28 Jul 2014 |
Copy link to clipboard |
 Print this post |
|
What is the message when it fails ?
John |
|
JohnS Guru
 Joined: 18/11/2011 Location: United KingdomPosts: 3998 |
Posted: 12:39am 29 Jul 2014 |
Copy link to clipboard |
 Print this post |
|
Looks an odd (as in: stray / extra) ; in that PRINT
5030 print BIN$(A(I))
JohnEdited by JohnS 2014-07-30 |
|
edu001 Regular Member
 Joined: 14/07/2014 Location: United KingdomPosts: 82 |
Posted: 12:40am 29 Jul 2014 |
Copy link to clipboard |
 Print this post |
|
Thanks for the reply's
WhiteWizzard advised me to do exactly what you suggested MM_Wombat
It fixed the problem |
|