Author |
Message |
Zonker
 Guru
 Joined: 18/08/2012 Location: United StatesPosts: 767 |
Posted: 07:57am 01 Mar 2015 |
Copy link to clipboard |
 Print this post |
|
Is there a way to change the baudrate of the "hardware" com ports..? I want to get higher speeds for the Maximite parts, (mono or color) and was wondering if this is possible... |
|
hitsware Guru
 Joined: 23/11/2012 Location: United StatesPosts: 535 |
Posted: 09:12am 01 Mar 2015 |
Copy link to clipboard |
 Print this post |
|
for midi I use:
OPEN "com4:31250" AS #1
the 31250 defines the baudrate
then
PRINT #4, CHR$(data)
No hardware ports on MaxiMite though .....DuinoMite or MicroMite have them
Two serial ports are available for asynchronous serial communications (four on the DuinoMite). They are
labelled COM1:, COM2:, etc and are opened in a manner similar to opening a file. After being opened they will
have an associated file number (like an opened disk file) and you can use any commands that operate with a file
number to read and write to/from the serial port. A serial port is also closed using the CLOSE command.
The following is an example:
OPEN “COM1:4800” AS #5
PRINT #5, “Hello”
dat$ = INPUT$(20, #5)
CLOSE #5
‘
‘
‘
‘
open the first serial port with a speed of 4800 baud
send the string “Hello” out of the serial port
get up to 20 characters from the serial port
close the serial port
The OPEN Command
A serial port is opened using the command:
OPEN comspec$ AS #fnbr
The transmission format is fixed at 8 data bits, no parity and one stop bit (two stop bits can also be specified).
‘fnbr’ is the file number to be used. It must be in the range of 1 to 10. The # is optional.
‘comspec$’ is the communication specification and is a string (it can be a string variable) specifying the serial
port to be opened and optional parameters.
It has the form “COMn: baud, buf, int, intlevel, FC, DE, OC, S2” where:
‘n’ is the serial port number for either COM1: or COM2: (plus COM3: and COM4: on the DuinoMite).
‘baud’ is the baud rate, either 19200, 9600, 4800, 2400, 1200, 600 or 300 bits per second. For COM3
and COM4 (DuinoMite only) it can be any number from 300 to 460800. Default is 9600.
‘buf’ is the buffer sizes in bytes. Two of these buffers will be allocated from memory, one for transmit
and one for receive. The default size is 256 bytes.
‘int’ is the line number, label or a user defined subroutine of the interrupt routine to be invoked when the
serial port has received some data. The default is no interrupt.
‘intlevel’ is the number of characters that must be waiting in the receive queue before the receive
interrupt routine is invoked. The default is 1 character.
All parameters except the serial port name (COMn:) are optional. If any one parameter is left out then all the
following parameters must also be left out and the defaults will be used.
Four options can be added to the end of 'comspec$' These are FC, DE, OC and S2.:
‘FC’ will enable hardware RS232 style flow control. This can only be specified on COM1: and it will
enable two extra signals, Request To Send (receive flow control) and Clear To Send (transmit flow
control) which can be used with a cooperating device to prevent data overflow.
‘DE’ will enable the Data output Enable (DE) signal for RS485. This can only be specified on COM1:
and it will enable the DE signal which will go high just before a byte is transmitted and will go low when
the last byte in the transmit buffer has been sent. DE and FC are mutually exclusive.
‘OC’ will force the output pins (Tx and optionally RTS or DE) to be open collector. This option can be
used on both COM1: and COM2:. The default is normal (0 to 3.3V) output.
'S2' specifies that two stop bits will be sent following each character transmitted.
Examples
Opening a serial port using all the defaults:
OPEN “COM2:” AS #2
Opening a serial port specifying only the baud rate (4800 bits per second):
OPEN “COM2:4800” AS #1
Opening a serial port specifying the baud rate (9600 bits per second) and buffer size (1KB) but no flow control:
OPEN “COM1:9600, 1024” AS #8
The same as above but with receive flow control (RTS) and transmit flow control (CTS) enabled:
OPEN “COM1:9600, 1024, FC” AS #8
An example specifying everything including an interrupt, an interrupt level, flow control and open collector:
OPEN “COM1:19200, 1024, ComIntLabel, 256, FC, OC” AS #5
MMBasic Language Manual
Page 55Input/Output Pin Allocation
COM1: uses pin 15 for receive data (data in) and pin 16 for transEdited by hitsware 2015-03-02 |
|
Zonker
 Guru
 Joined: 18/08/2012 Location: United StatesPosts: 767 |
Posted: 11:17am 01 Mar 2015 |
Copy link to clipboard |
 Print this post |
|
Hummm... Ok...
So, maybe order the DuinoMite-Mini Board from Olimex to use as the prototype and then get this going... I want to use this as a protocol converter to listen to the Rs-485 buss to receive data for the objects on the 4-D Systems 7" touch display used for my EIS system I am developing... The Duinomite also has the SDcard interface on it to store the "CSV" based log files being stored to keep track of the engine data collected during the flight of an ultralight aircraft... Logged data will consist of CHT, EGT temps, RPM, battery voltage and the like... Still working on the different parts of the system... This part will be one possible "display device" the pilot might choose to install...
There are other types of displays we are designing, one involves using a MM to drive very small servo's to create "old-school" style instruments if wanted... My friend ED (the guy with the 3-D printer) is creating the gauge casings and face plates for them... All displays will listen to the Rs-485 buss to get there data... The "front-end" module will be collecting the engine parameters and send out the Rs-485 data packets... I am thinking to using the LTC2983 from Linear Tech to get the temp data from the thermo probes... this is an awesome IC that uses the SPI port to transmit data and commands... This project is bigger that I first thought... Edited by Zonker 2015-03-02 |
|
hitsware Guru
 Joined: 23/11/2012 Location: United StatesPosts: 535 |
Posted: 11:46am 01 Mar 2015 |
Copy link to clipboard |
 Print this post |
|
> ‘baud’ is the baud rate, either 19200, 9600, 4800,
> 2400, 1200, 600 or 300 bits per second
None of those will do ? |
|
Zonker
 Guru
 Joined: 18/08/2012 Location: United StatesPosts: 767 |
Posted: 12:21pm 01 Mar 2015 |
Copy link to clipboard |
 Print this post |
|
Yep, it's working at 19200 now and is OK so far...
Was hoping for at least 115200 baud... The Display can go up to 600000..!! No need to go that high.! But, I just don't want the pass through data to build up and start causing problems... Receiving the Rs-485 packets, processing, limit checking, serial protocol conversion and sending the serial data to the display all takes time... Not to mention the writing of sample data to the log file on the SD-card in CSV format...
I won't know what the "final" loading will be on the Maximite until more of the code comes together... there are almost 20 different data objects to feed on the user display including the RTC.. Just trying to think ahead...Edited by Zonker 2015-03-02 |
|
Grogster
 Admin Group
 Joined: 31/12/2012 Location: New ZealandPosts: 9588 |
Posted: 12:46pm 01 Mar 2015 |
Copy link to clipboard |
 Print this post |
|
19k2 is as fast as the Maximite serial can run, due to them being software serial ports. 19k2 is plenty fast enough for most things, but there are times(like your example), where a high-speed serial is desirable. Smoke makes things work. When the smoke gets out, it stops! |
|
Zonker
 Guru
 Joined: 18/08/2012 Location: United StatesPosts: 767 |
Posted: 01:14pm 01 Mar 2015 |
Copy link to clipboard |
 Print this post |
|
Hummm...
After looking at the Olimex site, it looks like this is the project that caused Geoff all the grief about his firmware licensing issues.. The firmware was changed by this Ken Segler guy and I don't think he has kept up with the development of the package... Things look very "stale".. I wonder what's going on with it..? It seems to have a 32.768 Xtal on board but no mention of an RTC done in the firmware...
I think my feet are starting to get "cold" on this one... Money is very tight here and I can't afford to get sidetracked using this as the possible "core" part of the system design for the touch display part...
I much prefer to place my trust in the FINE group of people here at the shed and with Geoff at the helm, I think I can pull this thing together..!!
A big thank you to everyone here at TBS for helping me with this project..!!
Without the awesome work provided by everyone here, there is NO WAY I, (the dumbass) could even hope to put together projects like this..!! Edited by Zonker 2015-03-02 |
|
hitsware Guru
 Joined: 23/11/2012 Location: United StatesPosts: 535 |
Posted: 02:01pm 01 Mar 2015 |
Copy link to clipboard |
 Print this post |
|
MICROMITE ! |
|
Grogster
 Admin Group
 Joined: 31/12/2012 Location: New ZealandPosts: 9588 |
Posted: 02:16pm 01 Mar 2015 |
Copy link to clipboard |
 Print this post |
|
Yes, I also 2nd the MicroMite suggestion.
It does depend on what you are trying to do, but with the superb Cfunctions by matherp for driving TFT LCD screens of various sizes, these are a very viable alternative now.... Smoke makes things work. When the smoke gets out, it stops! |
|
MicroBlocks
 Guru
 Joined: 12/05/2012 Location: ThailandPosts: 2209 |
Posted: 06:53pm 01 Mar 2015 |
Copy link to clipboard |
 Print this post |
|
Zonker! I am working on a project using a 64 pin micromite with RS-485 and an LCD (using Matherp's CFunction), with optional FRAM and RTC, etc.
Give me a PM (with your email) if you want to collaborate on this, it might suit your needs.
Microblocks. Build with logic. |
|