|
|
View previous topic :: View next topic |
Author |
Message |
PannetierJ
Joined: 18 Jun 2017 Posts: 31
|
18F2550 + FT232RL pb to receive correct data |
Posted: Mon Jul 03, 2017 11:58 am |
|
|
Hello everybody,
I'm writing you because I'm trying to use an 18f2550 @ 8MHz crystal with an FT232RL for my RS232 connection.
My version of CCS info: 4.124
The electronic schema is:
My test code:
Code: |
#include <18F2550.h>
#fuses HS,NOLVP,NOWDT
#use delay(clock=8000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,ERRORS)
void main()
{
while(true)
{
putc('J');
}
}
|
My config with Putty :
I tried different config into my code and Putty.
Nevertheless, I receive always this:
It's really strange.
It's alive but bad data... Different Control.
I tried different code on this forum, without success.
Best regards
Thank |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Mon Jul 03, 2017 12:11 pm |
|
|
Your problem is you are not running at 8MHz.
Missing fuse:
Code: |
#include <18F2550.h>
#fuses HS,NOLVP,NOWDT,CPUDIV1
#use delay(clock=8000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,ERRORS)
|
The default CPUDIV fuse is 4, so with an 8MHz crystal, you are running at 2Mhz.... |
|
|
PannetierJ
Joined: 18 Jun 2017 Posts: 31
|
|
Posted: Mon Jul 03, 2017 1:15 pm |
|
|
Hi Ttelmah,
Super, now i can write " Hello World "
I didn't notice this Fuse ;)
I worked a whole afternoon yesterday, without seeing it.
Thank you |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Mon Jul 03, 2017 1:21 pm |
|
|
Sometimes it's 'eyes' 1/2 way round the World that can see what's wrong !
With those PICs I printout the 'clock diagram' and highlight the desired 'signal flow', then confirm the correct registers (SFRs) are being set/cleared.
It can be confusing....new PICs are far more complicated than the 16C84 !
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Mon Jul 03, 2017 11:47 pm |
|
|
Now, if you had done the 'flash an LED' test, you would have seen it was at 1/4 the speed expected, which might then have given you a clue 'where to look'. Anyway it was an easy one, where it has been 'met before'... |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Tue Jul 04, 2017 3:27 am |
|
|
Just one thing: what you've got has nothing to do with RS232. Its a USB connection using a USB to serial converter. At no point is the data carried by anything like RS232 signals.
There's nothing wrong with that, using this sort of connection is a perfectly sensible and effective way of connecting a PC, or other USB host device, to the PIC, it's just that it is not RS232, and you can't connect a RS232 port to it.
I use this sort of connection and recommend it, just as several other regulars on this forum do, generally as it's easier and less hassle and effort than using PIC chips with built-in USB, but its USB (using a small subset of USB's capability, not that it matters all that much) not RS232. I note you are using a PIC18F2550, which, of course, has built-in USB. I hope to be able to congratulate you for the sense for not using the PIC's USB and using an external serial-USB IC instead, but something is telling me, it may not be quite like that... |
|
|
|
|
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
|