Connecting PIC16F877A using Easypic5 via RS232 with Linux
I searched the forums for RS232 issues, but all of the results don't help me solving my problem, so I had to open new thread.
This is the problem:
I have PIC16F877A micro-controller and I'm programming it with Easypic5(the PIC programming device(board) from MikroElektronika) and I want to connect the EasyPic5 which has integrated RS232 port with my desktop computer that runs Ubuntu 11.10.
I don't need help with the code that runs the PIC micro-controller, I need help with C code that runs on the Linux computer in order to communicate with the PIC.
I made a simple program that runs on the PIC and send the char 'A' through the RS232 Port. What I want is receive that character in my own program which runs on the computer written in C. I tested my PIC program using CuteCom (a software for Linux that works with parallel ports, alternative to Windows utility Hyperterminal) and it works fine. So I concluded that the code in the PIC is fine. But when I want to receive the character in my own program I can't read nothing.
So, this is the workflow of the code:
1. Open the port /dev/ttyS0
2. Configure the termios structure and apply it to /dev/ttyS0
3. Read from that port
What I find difficult is 2nd step, configuring the termios structure for the port. So everytime I run the code, the read() command return -1 indicating an error.
What's interesting, whenever I run the code and CuteCom utility together, my code works!
I guess that running CuteCom sets other (the right ones) values for the termios structure and my program can read from the port.
The only thing that I set from the program that runs in PIC and is included in the termios structure is baudrate:2400.
Here is the code:
---------- Post updated at 06:35 PM ---------- Previous update was at 01:20 PM ----------
We are not "on call" here. If you don't get a reply instantly, wait!
Let me hunt up the code I use...
---------- Post updated at 11:48 AM ---------- Previous update was at 11:44 AM ----------
Try perror("read failed"); to see why read failed.
I rolled my own serial-port-opening function to make ordinary rs232 communication less of a hassle, with the result being tcgets.h and tcgets.c. You can open a serial port like int fd=termios_open("/dev/ttyS0", "2400N81");. Even if you don't use it, it should hopefully be a good example
I have been trying to get bluetooth working correctly on Linux for a while now. I am using two systems that are having identical issues: Linux Mint 15 64-bit & Ubuntu 13.04 32-bit. Both are using the Cinnamon desktop. I have the following bluetooth dongle:
... (6 Replies)
Hi Friends,
I configured CVS Repository in RHEL 5.3 Server. But connecting the CVS Repository get the error like.
# cvs -d:pserver:cvs@localhost:/backup/cvs/cvsrep login
Logging in to :pserver:cvs@localhost:2401/backup/cvs/cvsrep
CVS password:
cvs : connect to :2401 failed: Connection... (0 Replies)
Hi experts - I hope you can help me.
I am trying to resolve Windows host names (aka Netbios names, aka "UNC names) from a Linux box.
I have added "dns wins" to the "hosts" line at /etc/nsswitch.conf, and installed samba 3.2.2 and ran "winbindd -D".
Now, when I go: "wbinfo -N venus" (where... (1 Reply)
I just installed the latest version of unbuntu server and want to connect from windows using a ssh client. This is my first linux server, so bare with me =)
For my server...
cat /etc/hostsgives me
127.0.0.1 localhost
127.0.1.1 ubuntuHomeI tried using ssh secure shell and putty in vista.... (11 Replies)
Hello
i want to connect my solaris & Linux boxes to ntp server
i used the command
/usr/sbin/ntpdate -s -b -p 8 -u <NTP-IP>
and added the NTP server as server in /etc/ntp.conf
please help in completing the process and verifying it (1 Reply)
hello mates,
do you know a manufactor for rs232 serial pci cards for the sparc architecture? it seems that there is no original product from sun for that purpose. strange, isn't it?
problem is that i have a V250 with only one db9 rs232 serial port, and i need it for a modem connection, but i also... (1 Reply)
hi there!
I have a small, probably very dumb question. Is it possible to connect two linux boxes with each other over COM ports for terminal connection? (4 Replies)
Hi !
Is there somebody who is able to connect a VNC session via serial cable ?
There is a hint on the VNC homepage that it is possible to configure that.
But how?
thanks joerg (2 Replies)
Need help for RS232 communication with switches in order to optimise the data traffic. How to manipulate different flags in termios struct to do the same? (1 Reply)
I have a network consisting of Linux Server, Win-Nt & 95 OS. I am able to connect from Linux to Win-NT using either ftp / telnet in time. But it takes me around & more than 50 seconds to connect from Wint -Nt/95 to Linux using either ftp/telnet. My network is small & it hardly consists 20-25... (3 Replies)