Olimex Support Forum

DUINO => DUINOMITE => Topic started by: bvdb on December 08, 2016, 09:56:39 PM

Title: How send binary number out serial port on Duinomite?
Post by: bvdb on December 08, 2016, 09:56:39 PM
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
Title: Re: How send binary number out serial port on Duinomite?
Post by: Mr Hammond on December 09, 2016, 03:31:32 PM
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
Title: Re: How send binary number out serial port on Duinomite?
Post by: bvdb on April 30, 2020, 11:08:40 PM
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
Title: Re: How send binary number out serial port on Duinomite?
Post by: JohnS on April 30, 2020, 11:34:19 PM
Looks to be described in the manual under SERIAL Communication.

John
Title: Re: How send binary number out serial port on Duinomite?
Post by: KeesZagers on May 01, 2020, 08:31:46 PM
I'm not working with newer versions of MMBasic, but the open source version DMBasic 2.7 has a function V$=INPUT$(number,
Title: Re: How send binary number out serial port on Duinomite?
Post by: bvdb on May 04, 2020, 12:58:53 AM
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.
Title: Re: How send binary number out serial port on Duinomite?
Post by: KeesZagers on May 06, 2020, 10:51:04 AM
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.
Title: Re: How send binary number out serial port on Duinomite?
Post by: JohnS on May 06, 2020, 03:05:34 PM
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
Title: Re: How send binary number out serial port on Duinomite?
Post by: KeesZagers on May 09, 2020, 03:20:21 PM
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?
Title: Re: How send binary number out serial port on Duinomite?
Post by: bvdb on May 16, 2020, 06:53:57 AM
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