View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 15, 2008 1:03 pm |
|
|
Try this program. It blinks an LED on Pin B0. Does this program
compile with no errors ?
Code: |
#include <18F448.h>
#fuses HS, NOPROTECT, PUT, BROWNOUT, NOWDT, NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//======================================
void main()
{
while(1)
{
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
} |
|
|
|
Stephane Guest
|
LEDS |
Posted: Fri Jan 18, 2008 10:31 am |
|
|
Sorry I didn't see your answer (i didn't see there was a second page)
Same error message with this little program...
Yet i have tried another simple program with leds for a 18f448 just before yours (CAN BUS) and it was OK.
... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jan 18, 2008 11:37 am |
|
|
I was able to duplicate your problem. I commented out the #device
statement in the 18F448.h file, and I got the error message that you get.
Example:
Quote: | // Standard Header file for the PIC18F448 device
//#device PIC18F448
#nolist |
Question:
Did you do this ? Did you comment out the #device statement ?
If so, please put it back the way it was. Never edit the .H files. |
|
|
Stephane Guest
|
pic18f448 |
Posted: Sun Jan 20, 2008 12:15 pm |
|
|
First Thank you to help me
I didn't modify the 18f448.h :
I know this is a already made file and i don't touch this kind of file
I cannot find these lines in 18f448.h :
// Standard Header file for the PIC18F448 device
#device PIC18F448
#nolist
Maybe i've got a bad 18f448.h file ?
Another possible reason :
When i create a new PIC WIZARD PROJECT i choose the 18f448 PIC, 8 000 000 Mhz, High Speed Oscillator and i choose BUS CAN > USE CAN BUS
Do i have to choose other options ?
thank you again |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 20, 2008 1:57 pm |
|
|
I don't use the IDE version of the CCS compiler (such as PCWH).
I use the "command line" version, and I use MPLAB as the IDE.
In the command line version, all .H files have a #device statement for
the PIC at the start of the file.
I don't know what CCS is doing in the IDE version. |
|
|
Stephane Guest
|
News... |
Posted: Tue Jan 22, 2008 11:23 am |
|
|
i reinstalled my PIC C Compiler and i didn't update it
my current version in PCWH 3.212
And the program is compiled correctly ....
So for the moment it's OK !
I'll try it with 2 easypic flash modules soon and i'll say to you if it works fine.
Thank you for the time you gave to me
Feedback soon
(Next tuesday i think)
Stephane |
|
|
vinh Guest
|
new question |
Posted: Mon Mar 03, 2008 10:10 pm |
|
|
hi
I work in forklift truck field and I have 1 question to ask:
I have 6 controllers and two resistors 120 ohm and using CAN bus to
communicate. How can controllers communicate in this situation or they
have a CANchip interface that can communicate 6 controllers.
Hoping who know, reply soon.
thanks |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1908
|
|
Posted: Mon Mar 03, 2008 10:37 pm |
|
|
A very large number of controllers can be connected to one CAN bus. The 120 ohm resistors are placed at the two ends of the bus to prevent/minimize reflections. Controllers in the middle of the bus don't need termination resistors. |
|
|
vinh Guest
|
reply |
Posted: Tue Mar 04, 2008 8:00 pm |
|
|
sorry NewGuy
I don't understand what you mean controller in the middle, for my example, I have 6 controllers so you mean I need only 1 CANchip interface and two 120 ohm resistor placed in the start and end of the canbus. So you can show me more details about this problem. Why we only need two resistors and what kind of CANchip can we use in this case?(I saw you said that two resistors play a important role in preventing reflection, how important they are? If I don't have two resistors what happened? and what happened if I place another resistor in the middle of the CANbus)
see you soon
thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 04, 2008 8:33 pm |
|
|
Quote: | I have 6 controllers |
Tell us what a "controller" is. Describe it, or give the part number. |
|
|
vinh Guest
|
reply |
Posted: Tue Mar 04, 2008 9:12 pm |
|
|
PCM programmer wrote: | Quote: | I have 6 controllers |
Tell us what a "controller" is. Describe it, or give the part number. |
thanks for replying me soon PCM programmer
I said that I worked in forklift truck and they're modern truck, they have controller such as
traction controller
steering controller
hydraulic controller
display controller...
I just said like this and I saw in circuit they draw only two resistors 120 ohm
can you suggest me what kind of CANchip can they use?
thanks |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1908
|
|
Posted: Tue Mar 04, 2008 11:20 pm |
|
|
Regarding the general layout of a CAN bus, consult this thread: http://www.ccsinfo.com/forum/viewtopic.php?t=27504&highlight=bus+termination
There are quite a number of CAN transceivers available. Some are 'dumb' devices that just take care of driving/sensing the bus. Examples would be the LT1796 or MCP2551. Others, like the MCP2510 or MCP2515 also include the 'smarts' built into the chip that take care of the actual communication.
Any CAN compliant transceiver or transceiver with built-in controller will work as long as you're able to match the bus's bit rate. |
|
|
sresam89
Joined: 15 Mar 2012 Posts: 20 Location: India
|
|
Posted: Mon Apr 02, 2012 8:45 pm |
|
|
PCM programmer wrote: | Here is a simple test program which allows you to prove that two CAN
|
1. Can I use the same program for 18f4550/4585 ECAN controllers?
2. Will there be any other major changes in the program except for the headers? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 03, 2012 5:06 pm |
|
|
18F4550 doesn't have a CAN bus module. It has a USB module.
For the 18F4585, it should work, because the 18F4585 data sheet says:
Quote: |
The ECAN module is fully backward compatible with the
CAN module available in PIC18CXX8 and PIC18FXX8 devices.
|
|
|
|
|