Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:43 16 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Pi

Author Message
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 07:37pm 11 Dec 2020
Copy link to clipboard 
Print this post

Has anyone got serial inputs or outputs running on a Pi using pi-cromite?
I keep trying but it won't let me it always says "Error: Syntax"
I've been using "Open COM1:9600, test"  This work on MM+ I've also tried using open "com1:9600", "test" and many other variations as well as trying com2 but all say "Error: Syntax"

I need a connect a HC-12 module to send data to a normal MM across the room that has a HC-12 on it
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3476
Posted: 08:34pm 11 Dec 2020
Copy link to clipboard 
Print this post

Another comma before test?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4147
Posted: 09:00pm 11 Dec 2020
Copy link to clipboard 
Print this post

It'll be something like

Open "COM1:9600, , test" as #1

Note the extra comma already mentioned as you're leaving out a parameter.

John
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 09:14pm 11 Dec 2020
Copy link to clipboard 
Print this post

Thank you so much
I don't get what the other comma was for though
the manual says OPEN comspec$ AS [#]fnbr
which I thought was open "com1 : speed" AS #1 is the port number to use in the program?

EDIT:
it doesn't work

[1] Open "COM1:9600, , test" As #1
Error: Cannot find label
Edited 2020-12-12 07:18 by lew247
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3476
Posted: 09:26pm 11 Dec 2020
Copy link to clipboard 
Print this post

Do you have a subroutine named "test"?

Perhaps provide an entire (small) program showing the error.

This doesn't do anything, but doesn't get a syntax error:

open "com2: 9600,,test" as #1

do: loop

sub test

end sub


Edited 2020-12-12 07:37 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3476
Posted: 10:21pm 11 Dec 2020
Copy link to clipboard 
Print this post

Another question is, if you don't have a "test" interrupt routine, do you need one? There are other, perhaps better, ways of checking on serial input, since the generous buffer available allows you to check the serial input at your leisure.

So you might only need: open "com2: 9600" as #1
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 478
Posted: 05:12am 12 Dec 2020
Copy link to clipboard 
Print this post

  lew247 said  Thank you so much
I don't get what the other comma was for though
the manual says OPEN comspec$ AS [#]fnbr
which I thought was open "com1 : speed" AS #1 is the port number to use in the program?


From the manual:
It [comspec] has the form "COMn: baud, buf, int, int-trigger, (DEN or
DEP), 7BIT, (ODD or EVEN), INV, OC, S2"
Where:
 ‘n’ is the serial port number for either COM1:, COM2 or COM3:.:.

 ‘baud’ is the baud rate. This can be any value between 1200 (the
 minimum) and 1000000 (1MHz). Default is 9600.

 ‘buf’ is the receive buffer size in bytes (default size is 256). The
 transmit buffer is fixed at 256 bytes.

 ‘int’ is a user defined subroutine which will be called when the serial
 port has received some data. The default is no interrupt.

 ‘int-trigger’ sets the trigger condition for calling the interrupt
 subroutine. If it is a normal number the interrupt subroutine will be
 called when this number of characters has arrived in the receive
 queue.

so the third parameter (if there is one) is buffer size. If test=0 then

open "COM1:9600,test" as #1

is an illegal statement since you can't have a buffer size of 0.

open "COM1:9600,,test" as #1

means open COM1: at 9600 baud with a 256 byte buffer (the default) and call a routine called "test" when you're received some data.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025