![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
nando88
Joined: 25 Aug 2013 Posts: 28
|
USB Serial port communication for pic18f2550 |
Posted: Thu Dec 25, 2014 6:04 pm |
|
|
I was able to make my application work with the help I received in this forum, but that was when I was using the pic 18f4550.
Now I'm using a dev board with the pic18f2550, and I changed the include in my code, but when I install the driver, I get error code 28.
If someone could please help me fix this problem, I would be so grateful.
I will leave the code I'm using in this link:
http://www.mediafire.com/download/igswpdai4padduk/Working_Code_-_Pic18f4550.zip
This is the code that I used to get my app working with the pic18f4550.
I just need to be able to use this same code, but with pic18f2550.
The only thing is that in order for me to upload this code to my dev board, the hex file can't have any comments in it, so I have to erase the last 2 lines in this file. I really don't know if this makes any difference.
Thanks. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9173 Location: Greensville,Ontario
|
|
Posted: Thu Dec 25, 2014 6:27 pm |
|
|
First is the HARDWARE correct? 2550 is a 28 pin device not a 40 , so be sure you've got the right pins going to the correct places !!
Second, your 'working code'... does NOT have the first line such as ...
#include <18f2550.h> //PIC header MUST be 1st line in program
... without this, compiler will halt as it doesn't know which PIC you're using !
Since the ONLY differences i can easily see are these two items, try them and see
recode/recompile/retest/report back
hth
jay |
|
![](templates/subSilver/images/spacer.gif) |
nando88
Joined: 25 Aug 2013 Posts: 28
|
Working code |
Posted: Thu Dec 25, 2014 6:50 pm |
|
|
I know what you mean, when you say there is no include in the main file, but the thing is that it worked fine with the pic18f4550 dev board. I think its because I'm importing the usb_desc_cdc, and the ex_usb_common.
I tried changing the includes in those files, so that I could get this code working for this other dev board, but I get error code 28, when I install the driver.
I'll have to change the output pins, but that is all I can think of. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19366
|
|
Posted: Fri Dec 26, 2014 9:01 am |
|
|
Not quite.
It's because the usb_common file you have has been modified.
There is an option in this, just after the initial 'remarks', to have a number of different processors selected - section marked 'Begin User Configuration'. You remove the 'rem' for the processor you want to use for a number of 'standard' configurations. The first one, selects the 4550:
Code: |
//#define USB_HW_CCS_PIC18F4550 //CCS PIC18F4550 USB Development kit
|
If this is not remmed, the code sets itself to use the 4550.
You don't want to touch this file at all. Remove it from your includes. This is a set of standard setups for a number of development boards, which you are not using.
Instead, have:
Code: |
#include <18F2550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000)
//see section below labeled USB_CABLE_IS_ATTACHED
#define PIN_USB_SENSE PIN_B2
#define HW_ADC_CONFIG ADC_CLOCK_DIV_64
#define HW_ADC_CHANNEL 0
#define HW_ADC_PORTS AN0
#define HW_INIT() setup_adc_ports(HW_ADC_PORTS)
#define USB_CABLE_IS_ATTACHED() input(PIN_USB_SENSE)
#define __USB_PIC_PERIF__ 1
#include <usb_desc_cdc.h>
#include <usb_cdc.h>
//Then your code.
|
This sets everything up on the 2550, to match the settings for the 4550, with development board, without the LED's and inputs (since you don't seem to be using these). |
|
![](templates/subSilver/images/spacer.gif) |
nando88
Joined: 25 Aug 2013 Posts: 28
|
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9173 Location: Greensville,Ontario
|
|
Posted: Fri Dec 26, 2014 12:04 pm |
|
|
Please post the text surrounding the 'error 28' that you're getting. I downloaded your zip file, and the .err file only has 2 WARNINGs no errors.
CCS list the errors as text in the manual,not by error number so I can't xref 28.
edit: OK I googled ccs c compiler error 28 and got this...
*** Error 28 "C:\Users\Orazio\AppData\Roaming\PICC\Projects\TCPIP Stack\GenericTypeDefs.h" Line 64(28,29): Expecting an identifier
...
So I'm assuming you got something similar
Error 28....*** Error...... Expecting an identifier
???
jay |
|
![](templates/subSilver/images/spacer.gif) |
nando88
Joined: 25 Aug 2013 Posts: 28
|
Problem fixed |
Posted: Fri Dec 26, 2014 6:26 pm |
|
|
The problem I had was with the os. It did not allow me to install any drivers.
I just fixed the problem and got my app working thanks to you guys. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|