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 : command DEVICE SERIALTX
Author | Message | ||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
The instructions on page 89 contain the command DEVICE SERIALTX pinno, baudrate, ostring$ and the note ‘NB command is blocking during transmission.’ What does NB command mean? And is it 8N1 ? @geoffg The command is repeated on page 92. The same applies to DEVICE SERIALRX. (WebMite User Manual MMBasic Ver 5.08.00 Revision 2) Matthias |
||||
Andy-g0poy Regular Member Joined: 07/03/2023 Location: United KingdomPosts: 56 |
N.B. Latin abbreviation for "nota bene" Means "note well" Andy |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6780 |
NB just means "Note this:" It means that the MMBasic program is suspended during transmission or reception. That'll be because you can't allow other processes to mess up the timing. There's examples in Appendix A of the manual. Options for the port are set in the OPEN command. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
That's what I had feared I can only find the hardware UART examples Com1 and 2. How is OPEN supposed to work with ‘DEVICE SERIALTX pinno, baudrate, ostring$’? Matthias |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6780 |
The COM ports are buffered. That makes things much easier. Sorry, I've not used DEVICE SERIAL. Maybe that isn't using the hardware UARTs and isn't buffered? Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
No, it does not. That's when Com1 and Com2 are already occupied and you need another channel to send, SoftUart that is ;-) But I had already suspected this. Matthias |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3800 |
How many COM ports do you need? (Or COM-like.) Maybe PIO could do an extra one? John |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
As many as possible! Yes, thanks John for the tip. I already use the PIO for reception (Rx). As I use the Pico Wlan, I only have the 0 PIO of the two PIOs available. I can now use the 4 state machines for 2x Rx and 2xTX or and that was my hope: 4x Rx and another 4x via DEVICE SERIALTX. Then I would ideally have 2 Hardware Com + 4 Pio/Soft Com. Or does anyone have a brilliant solution to put both Rx with interrupt and Tx in one state machine? Matthias |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6780 |
A host of Zeros. Two nice, buffered COM ports each and linked together over I2C. :) Then when you run out of addresses use the other I2C port.... . Edited 2024-08-16 07:17 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Unfortunately, I haven't quite understood it yet :-( Now I want to try the other direction (send) and I fail ... It looks like the OUT does not write from the OSR to the PIN. Can anyone tell me my mistake? Matthias ' pio out TEST '-------------------------------------------------- 'Only PIO 0 is available on the WebMite 'as PIO1 is used by the WIFI interface ' 'disconnect ARM from GP14 SetPin GP14,pio0 Dim d%,b%,o% ' PIO ASSEMBLE 0,".program uart_tx" PIO ASSEMBLE 0,".side_set 1" PIO ASSEMBLE 0,"set pindirs, 1" PIO ASSEMBLE 0,".wrap target" PIO ASSEMBLE 0,"pull side 1 [7]" PIO ASSEMBLE 0,"set x, 7 side 0 [7]" PIO ASSEMBLE 0,"bitloop:" PIO ASSEMBLE 0,"out pins, 1 " PIO ASSEMBLE 0,"jmp x-- bitloop [6]" PIO ASSEMBLE 0,".wrap" PIO ASSEMBLE 0,".end program list" 'configure pio0 StateMachine 1 f=31250*8 ' a b c d e f g a,e=side set c,g=OUT p=Pio(PINCTRL 1,1,1,gp15,gp14,gp14,gp14) e=Pio(execctrl gp15,Pio(.wrap target),Pio(.wrap) ) ' 7 . s=Pio(shiftctrl 0,7,0,0,1,1) 'write the configuration PIO init machine 0,0,f,p,e,s,0 'start the pio0 code state machine 0 PIO start 0,0 'MAIN Do 'nothing Pause 500 o%=&haa Print Bin$(o%) 'Print "Status1:", Pio(FLEVEL 0 ,0 , tx) PIO write 0,0,1,o% Print "..." Loop End Footnote added 2024-08-18 04:58 by homa Wrong Thread! This is the right one; https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=17155 |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6780 |
Hmmm... DEVICE SERIAL TX and DEVICE SERIAL RX are not buffered. It doesn't matter in a way because the program hangs until they have completed or timed out. It could mess up other stuff, I suppose. The hardware UARTs might continue to run using their buffers during this time. PIOs would just run as normal providing they aren't waiting for the main CPU to come free. Sorry, I can't comment on your program. I don't have enough PIO experience to follow it. :) Could your com ports run only on request? I was wondering about using some sort of multiplexer with a single port. If not then the answer might be to use a Parrallax Propeller to provide the ports. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Hi Mick, sorry, wrong thread. What did you mean by: I'm looking for i2c to uart controller ... but I only found a board that can't handle 31250 baud ... |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6780 |
The RP2040-Zero is a cheap little Chinese version of the Pico. My idea is that each one has the usual pair of COM ports, so you get two buffered ports as usual. Hiwever, you could link a number of them together over I2C to one common master. That way you have all your ports buffered and handled independently (never more than two per processor) and can read/write them as required. It was a bit tongue in cheek really, but it's pico-parallel-processing. :) You could use a version of my RPZ Compute modules designed just for two COM ports each and plugging into a motherboard set up for I2C. If in doubt throw hardware at the problem until it goes away. :) I2C to UART? The COM ports should be able to send and receive at that speed under MMBasic, I think. They have TX and RX buffers. You'll have to watch the buffer sizes though. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Print this page |