|
Forum Index : Microcontroller and PC projects : Pi
| Author | Message | ||||
| lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1702 |
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 StatesPosts: 3476 |
Another comma before test? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4147 |
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 KingdomPosts: 1702 |
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 StatesPosts: 3476 |
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 StatesPosts: 3476 |
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 StatesPosts: 479 |
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. |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |