How send binary number out serial port on Duinomite?

Started by bvdb, December 08, 2016, 09:56:39 PM

Previous topic - Next topic

bvdb

Hi Everyone,

I would like to send some binary data out the serial port and to the SD card.  If I send &HFF to the serial port is actually transmits the three ASCII digits 255.   Using MMBasic Ver 4.4

Could really use some hlpe here.

Thanks,

Bert

Mr Hammond

Hi,
Try Printing CHR$(&H255);
When I run:
10 PRINT CHR$(&H41);
it displays an A on the screen, which is a single byte of value &H41
Hope that helps

bvdb

Hi.  Can someone help me figure out how to read binary data on the Duinomite serial port in MMBASIC?

If you use the Line Input #1,A$ it works fine with ASCII data but does not work with binary data.

Regards,

Bert

JohnS

Looks to be described in the manual under SERIAL Communication.

John

KeesZagers

I'm not working with newer versions of MMBasic, but the open source version DMBasic 2.7 has a function V$=INPUT$(number,
  • file-number). This function enters a number of bytes from either a file or serial port. The serial ports are configured for 8 bits, so in principle this should work.

bvdb

Hi Kees,

The A$=INPUT$(No, File#) only works with ASCII data being sent to the Duinomite.  If you send binary data it doesn't work. 

For now I am converting the binary data to ASCII hexadecimal but that's a pain and takes twice as many bytes to send the same amount of data.

So far I have not been able to figure out a way to receive binary serial data with the Duinomite board.

KeesZagers

I will check the DM 2.7 sources on this subject. As far as I know you can use the full 8 bit data in a string, however the display only shows the ASCII characters.

JohnS

I've used INPUT$ and it appeared fine regardless, same as any other Basic I've used.

I think it's a newbie misunderstanding.

John

KeesZagers

John, I like newbies, because I can teach them something  ;)

A$=INPUT$(10,#1)
FOR x=1 TO 10
PRINT ASC(MID$(A$,x,1))
NEXT

This should give all 8 bit data, which comes either from a file or a serial input.

Kees

BTW Bert are you Dutch or Belgian?

bvdb

Hi Kees,

I'll try your suggestion.

I was born in Holland.  Lived there for 9 years then the parents moved us all to the USA where I lived for 35 years.  Been living in New Zealand for the past 26 years (yes I'm really old).

The entire family loves New Zealand.

Thanks for your help