 |
 |
| View previous topic :: View next topic |
| Author |
Message |
Ttelmah
Joined: 11 Mar 2010 Posts: 20161
|
|
Posted: Sat Dec 29, 2012 5:14 am |
|
|
Er.
If you have not got an external crystal, then you need to be using the internal oscillator, not 'XT'.....
FRC, or one of the divisions/PLL multiples from this. Start simple:
| Code: |
#include <33FJ128GP802.h>
#FUSES NOPROTECT //General Segment Code not Protected
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES FRC //Internal RC at default frequency
#FUSES NOWDT //No Watch Dog Timer
#use delay(clock=7.37MHz) //default frequency for RC
|
Best Wishes |
|
 |
andys
Joined: 23 Oct 2006 Posts: 175
|
| rs232 software |
Posted: Sat Dec 29, 2012 12:14 pm |
|
|
Now with the last comment of the Ttelmah everything working fine.
Thanks all of you guys. |
|
 |
andys
Joined: 23 Oct 2006 Posts: 175
|
| rs232 software |
Posted: Wed Jan 16, 2013 5:43 pm |
|
|
I tried to use usb to rs 232 converter and i face the old problem of see strange character on the screen.
What i will need to change if i use usb to rs232 converter ? |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9658 Location: Greensville,Ontario
|
|
Posted: Wed Jan 16, 2013 6:03 pm |
|
|
First, I'm assuming you have the PIC connected to a MAX232(or equal chip) connected to a PC and as you've said that 'system' with your software is working 100%.
If this is so, then the addition of a USB<-> RS232 convertor should be easy,just be sure that the Txd and Rxd lines are connected correctly.
Also verify the ground !
Getting 'wrong ' characters might mean you have a USB<->TTL convertor and so there is data inversion(0=1, 1=0).
Without seeing the specs for the device, I can't tell.
Simple test though, to confirm the USB<->RS232 device is working, just put a jumper between pins 2 and 3 of it and run a PC terminal program.Typing on the keyboard should be displayed on the PC screen.
If this test fails , you'll have to fix the PC, use another convertor, or ??? to fix this before you connect the PIC board.
hth
jay |
|
 |
andys
Joined: 23 Oct 2006 Posts: 175
|
| rs232 software |
Posted: Wed Jan 16, 2013 8:03 pm |
|
|
I have already test it by connect the rx with tx and using keypad and is ok.
Also i tried to change the positions between rx and tx but when i did this i can not see anything to the screen.
Also to describe more accurate the problem i see stranger character to the screen and the i get a message "Error reading from serial device" and the connection stop.
How to solve this ??? |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9658 Location: Greensville,Ontario
|
|
Posted: Thu Jan 17, 2013 6:34 am |
|
|
hmm...here's the steps I'd take...
1) connect the USB<->RS232 module to the PC
2) connect pins 2 and 2 together of the RS232 side of the module
3) run a 'terminal' program and confirm this 'loopback' test functions properly.Be sure to type several lines of words,symbols,etc.I start with 'qwerty....' and go row by row.Set the program up to say 9600 baud.
4)ONCE this test is confirmed working then.....
5)Connect a MAX232(with caps!) to the USB<->RS232 module. connect the ttl side TX and RX pins of the MAX232 together.Run step(3) again. This will confirm the MAX232 is OK.Be sure NOT to have PIC txd,rxd pins connected at this step.
6) Connect your PIC with MAX232 to the PC.Burn a simple 'loopback' program(CCS shows one in the FAQ section of the Help screens(F11).Again be sure the baudrates are the same(9600 is nice). do step (3) again....confirming the PIC hardware and program are OK.
If it's not...you have a problem.Usually it's either wrong fuses,RS232 'options', or hardware.
Debugging hardware is the same as software. You've got to start with a known starting point, test, build upon observations,step by step, doing ONE change at a time.
hth
jay |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|