|
|
View previous topic :: View next topic |
Author |
Message |
sraiderk
Joined: 09 Feb 2005 Posts: 48
|
18f4550 UART Problem |
Posted: Mon Mar 19, 2007 7:41 am |
|
|
I used 18f452 with uart. Circuit is working. If I use the 18F4550. The other circuit doesn't take value from uart. My clock definition is correct for 18f4550 using externel 20MHz cristal, isn't it?
with 18f452 (it works)
#include <18F452.h>
#device adc=10
#fuses NOWDT,HS, NOPUT, NOPROTECT, noBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
#use delay(clock=20000000)
#use rs232(baud=96000,parity=E,xmit=PIN_C6,rcv=PIN_C7,bits=8,errors)
with 18f4550 (it does not work)
#include <18F4550.h>
#device adc=10
#fuses NOWDT,HS, NOPUT, NOPROTECT, noBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
#use delay(clock=20000000)
#use rs232(baud=96000,parity=E,xmit=PIN_C6,rcv=PIN_C7,bits=8,errors) |
|
|
Ttelmah Guest
|
|
Posted: Mon Mar 19, 2007 8:13 am |
|
|
Do you really mean '96000' bps?.
You need CPUDIV1. It ought to default to this, but 'no guarantees'.
Presumably you are not wanting to use the USB, otherwise different fuse patterns will be needed.
Best Wishes |
|
|
sraiderk
Joined: 09 Feb 2005 Posts: 48
|
|
Posted: Mon Mar 19, 2007 8:28 am |
|
|
Ttelmah,
I appologise to you, It should be 9600. |
|
|
sraiderk
Joined: 09 Feb 2005 Posts: 48
|
|
Posted: Mon Mar 19, 2007 8:31 am |
|
|
Ttelmah,
I used 18f4550 with USB & PC with the following fuse. It's perfect. Yes, Now I don't need to use USB pattern. I want to use this pic like 18f452 for UART communication.
//#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
//#use delay(clock=48000000) |
|
|
Ttelmah Guest
|
|
Posted: Mon Mar 19, 2007 1:39 pm |
|
|
So, what happens if you add CPUDIV1?.
The CPUDIV fuse behaves differently, according to whether you select HS, or HSPLL. In the latter case, the crystal frequency is fed to the PLL system, and then divided (based on the PLLn fuse), to give 4MHz. This is then multiplied to give 96MHz, and this is then divided by two, to then feed the 'CPUDIV' divider. , In 'HS' mode the external crystal, feeds directly to the CPUDIV divider.
Best Wishes |
|
|
sraiderk
Joined: 09 Feb 2005 Posts: 48
|
|
Posted: Tue Mar 20, 2007 3:12 am |
|
|
Ttelmah,
I made a lot of test I reached very interesting result. Firstly, I use the pcwh 3.245.
I made the test circuit that has standart pic-pc connection using the RS232 level converter. I made 4 test using 18f4550 and 18f452.
Not: all test are maden for these two pic with the same fuses.
(#fuses NOWDT,HS, NOPUT, NOPROTECT, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
#use delay (clock=20000000) )
firstly, baudrate :9600 send the data using printf("hello") function. Both chip ok.Pc takes the value.
secondly, baudrate :9600 send the data using #int_TBE" function. Both chip ok.Pc takes the value.
thirdly, baudrate :115200 send the data using printf("hello") function. Both chip ok.Pc takes the value.
4., baudrate :115200 send the data using #int_TBE" function. 18f452 sending data (ok).Pc takes the value. But, 18f4550 sending data but, Pc doesn't take data.
for last step, I made alot of time . Result never change. What's your succestion to me? Because #int_TBE" & High baudrate is important for me. |
|
|
|
|
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
|