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 : Can't read on RS232
Author | Message | ||||
jeannot46 Newbie Joined: 29/05/2024 Location: FrancePosts: 8 |
Hello , I am beginner , i get a Pico Game Vga , with 2 db9 , and jdy40 , i can send "hello" to my Linux PC running Moserial , but i can t send to my Pico Mite with db9 or jdy40 , with jdy40 i ear the data come but nothing on vga screen connect to the Pico. Thank you very much. jean |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4223 |
Hi Jeannot, The PicoGame VGA DB9 is not a serial connector, but a game controller interface. Some pins of the DB9 can be programmed for serial connection, but the pinout is not compatible with a PC serial port from the 80's. It is designed to connect to a NES type game controller. What is your project ? Do you want to communicate serial with a PC, or with a GPS receiver, or with another microcontroller ? Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6783 |
I'm guessing this is a PicoGAME VGA Version 2? If so then the DB9 marked B can be used as a COM port. The connections are NOT standard for a DB9 serial port though. This is, I'm afraid, one of my designs. :) I must admit that I never tested the serial communications side very much, although I've had the various parts working separately. The JDY-40 isn't very good. COM2 TX / GP4 is pin 2 COM2 RX / GP5 is pin 3 GND is pin 8 The JDY-40 uses the same COM port so you can only use one at once. You have to set the PicoMite to use it as COM2 before it can be used: SETPIN GP5, GP4, COM2 Then OPEN "COM2:9600" AS #3 'opens the port at 9600 baud Now, if you are sending it a 10-character message you could use dat$ = INPUT$(10,#3) PRINT dat$ CLOSE #1 This would wait until characters have been received then print the string and close the connection. The #3 is a file number and can be 1 to 10. The # is optional. You may have to send CR LF after the 10th character. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
jeannot46 Newbie Joined: 29/05/2024 Location: FrancePosts: 8 |
Hello , and thank you very much , "This would wait until characters have been received then print the string and close the connection. The #3 is a file number and can be 1 to 10. The # is optional." the program dont wait characters , it close and return to prompt . I confirm it s a PicoGAME VGA Version 2. Good night jean |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6783 |
Is your transmit baud rate correct? Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4223 |
Please paste your program here, so we can help you. Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6783 |
Good idea. Press the "code" button above then paste your program between the [code] and [/code]. That will preserve any formatting that you might have used. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
jeannot46 Newbie Joined: 29/05/2024 Location: FrancePosts: 8 |
Hello , The code is like the book MMBasic code: 10 SETPIN GP5, GP4, COM2 20 OPEN "COM2:9600" AS #5 30 PRINT #5, "Hello" 40 dat$ = INPUT$(3, #5) 50 CLOSE #5 My wiring is correct DB 9 : Pin 2,3,8 My computer receive "Hello" , the program don't wait for receive the data ex: 123 from computer , it'run send data and prompt. Thank you very much for your help. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6783 |
If you don't include PRINT dat$ at some point you won't see anything. Line 40 gets the data from the serial port and puts it into dat$, but that's all. The connection will then close. Try adding 60 PRINT dat$ and see if you get anything then. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
jeannot46 Newbie Joined: 29/05/2024 Location: FrancePosts: 8 |
Hello , 10 SETPIN GP5, GP4, COM2 20 OPEN "COM2:9600" AS #5 30 PRINT #5, "Hello" 40 dat$ = INPUT$(3, #5) 50 CLOSE #5 60 PRINT dat$ Nothing better , i don't understand my problem , i have verified another time my wiring ,i see the data with logic analyser. usb profilic 3v3 green wire to db9 pin 3 , white wire to db9 pin 2 , Black wire to db9 pin 8 GND , Red NC Same problem with true RS232 port on DELL Laptop. Don t know what . Edited 2024-05-31 04:45 by jeannot46 |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4223 |
Hi Jeannot, In MMBasic you do not need to use line numbers. In your program you read only 3 characters from the the serial port. Your wiring is okay (green/white wires connect correctly) What normally happens is that you open the port, keep it open until you are done. Below program is a miniature terminal program. You can use it to test your hardware. I used it to talk to a chess engine through serial port. 'setup COM2 to communicate with 9600 baud SetPin gp5,gp4,COM2 Open "COM2:9600" As #1 Do 'keyboard text to chess module a$=Inkey$ If a$<>"" Then Print #1,a$;:Print a$; If a$=Chr$(13) Then Print 'feedback from chess module l=Loc(#1) If l>1 Then Print Input$(l,1); Loop Until a$=Chr$(27) 'stop when <ESC> CLOSE #1 The Loc(#1) is an indicator how many characters there are in the input buffer of #1 serial port. When there are any (not 0), it reads that many characters from the port. I hope this helps you. Volhout Edited 2024-05-31 05:37 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
You probably need to wait for the computer to respond. Look up the LOC function. After PRINT #5, "Hello", add Do : Loop While Loc(#5)=0 ' wait until a character has been received PAUSE 10 ' wait until all characters have arrived (Note: you don't need line numbers--they've been obsolete and deprecated in BASIC for 30 years or more. There are DO loops, FOR loops, subroutines, and CASE statements which eliminate almost all need to GOTO a line number or label.) PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2075 |
deleted Edited 2024-05-31 17:32 by CaptainBoing |
||||
jeannot46 Newbie Joined: 29/05/2024 Location: FrancePosts: 8 |
Hello , I thank you all, I go home Monday evening, I will be able to test the code, I started on a zx81 at the age of 13, hence the line numbers, afterwards I learned C, now I work during the week and weekend on industrial plc. Good night everyone and a big thank you. |
||||
jeannot46 Newbie Joined: 29/05/2024 Location: FrancePosts: 8 |
Hello everyone , My mission extends for 1 more month, I will only return to test at the beginning of July, however I would like to thank you for your precious help. JiJi |
||||
jeannot46 Newbie Joined: 29/05/2024 Location: FrancePosts: 8 |
hello everyone , Nothing work may be PicoGAME VGA Version 2 don t accept serial com. thank you very much |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6783 |
Have you tried linking pins 2 and 3 of Port B and trying a loopback test on COM1? It's not a complicated circuit. R19 and R21 are pretty high value pullups, so basically you have R18 in series with pin 2 and R20 in series with pin 3. D4 and D5 do nothing at normal 3V3 voltage levels. RX data is clamped by R20, D4 and D5 to make sure it remains within the voltage limots of the PicoMite. TX data doesn't need that, R18 is included to protect from short circuit conditions. R18+R19 and R20+R21 are also the joystick pullups. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
jeannot46 Newbie Joined: 29/05/2024 Location: FrancePosts: 8 |
hello , i shorted 2 and 3 no local echo loopback |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6783 |
Have you checked the continuity between pins 2 & 3 and the pins of the PicoMite? (remember the resistors). I'm just wondering if there's a bad joint or something. Also check the diode polarity. You could also try setting the pins as digital outputs and switching them on and off from the MMBasic command line to prove that the pins are working. Edited 2024-06-14 07:34 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Print this page |