View previous topic :: View next topic |
Author |
Message |
SW
Joined: 09 Jun 2011 Posts: 10
|
CCS Compiler Troubleshooting |
Posted: Sun Jun 26, 2011 7:08 pm |
|
|
I am still stuck in the troubleshooting phase after about 10 days of setting up a new computer system. I did finally get past the "hello world" with flashing LEDs, so now it's on to serial I/O. My code is as follows:
Code: |
#include <16f877a.h>
#fuses HS,NOWDT
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)
#include <stdio.h>
void main(void)
{
while(1)
{
printf("HiThere");
}
}
|
This leads me to the shortest of two issues--I get garbage displayed on Tera Term, which is a replacement for Hyper Terminal. You'll agree if you look at the following link:
http://imageshack.us/photo/my-images/151/image1ve.jpg/
I read another post that described a similar problem and the fix was to check the ground for the USB-Serial converter. I have the converter's ground wire on the same ground as the PIC. I have also moved it to another part of the grounding rail to make sure the connection wasn't in question.
"Why is he using Tera Term when CCS has a fully functional serial port monitor" you may be wondering. That leads me to issue #2. The "Serial Port Monitor" is one of a few buttons that apparently have no function when I click on them.
I used the CCS compiler on a Windows XP machine for a year and a half without issue. I am now working with Windows 7 and a newer version of CCS. Is there a compatibility issue I am unaware of? It's much easier to troubleshoot software and hardware problems when only one or two variables change, but when all of the variables change it gets significantly more difficult. The CCS version is 4.093. I have tried compatibility modes with no luck either.
Any help is greatly appreciated.
Thank you, _________________ -SW |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Mon Jun 27, 2011 2:40 am |
|
|
Teraterm is fine. In fact you will find many people here suggesting it rather than Hyperterm.
Now you talk about using a USB-serial converter. However no mention of a MAX232?. You need this, unless your USB-serial is one of the 'embedded' type designed to wire directly into a board.
Key thing to understand, is that the PIC _does not generate RS232_. It generates TTL async serial. To make this into 'RS232', _requires_ a converter chip (signal level converter and inverter), like the MAX 232.
Now, if we look at bit patterns, 'Hi', gives:
xxx10000101001xxxx0100101101
while, 'o-', needs:
101111011010101101001
Inverting the second character in the former (changing 1's for 0's), gives:
1011010010
and a little look along this, shows that this agrees exactly with the o- bit pattern you have.
So you are missing the hardware inverter needed between the PIC and your USB adapter.
Best Wishes |
|
|
drh
Joined: 12 Jul 2004 Posts: 192 Location: Hemet, California USA
|
|
Posted: Mon Jun 27, 2011 8:10 am |
|
|
Quote: | That leads me to issue #2. The "Serial Port Monitor" is one of a few buttons that apparently have no function when I click on them. |
The utilities are not included with the compiler download. They are a separate download. _________________ David |
|
|
SW
Joined: 09 Jun 2011 Posts: 10
|
|
Posted: Mon Jun 27, 2011 3:19 pm |
|
|
Thank the both of you. Your responses explain a lot! Basically, my old system was an 18F4520 development board with accompanied software run on an XP machine. I'm now trying to build my own system up using individual pieces. Apparently, the development board must have had the MAX 232 onboard and I was unaware of it.
I'm referencing "Embedded C Programming and the Microchip PIC" and it appears that TTL to serial conversion is something that falls under "very little hardware knowledge required". I guess I have less than that.
Do you have any recommendations for books or websites that support "next to no hardware knowledge"?
Thanks! _________________ -SW |
|
|
|