Hai I require simple c code for transmit and receive throuh CAN1 and CAN2 in LPC2129 . Please send some sample to me
Sorry .. I need some simple codes for CAN for LPC2129. Can't it be done by directly using the CAN registers?
So then I repeat my question: HOw much time have you spent looking at the sample code available from the NXP web site?
Why don't you think that the sample code do use the CAN by directly using the CAN registers?
As, i am just from 8051 to ARM programming ,That example codes found more complex. Nearly I had spent some 3weeks on the code.
In that the BlinkyCAN example... to test in board have i to connect the CAN ports by wires(CAN_h and CAN_L of 1 and 2)
martin martin martin martin,
Nearly I had spent some 3weeks on the code.
how long did you spend learning the data sheet of your new hardware?
A month
Of course it can!
The only thing that actually has any effect on the processor is accessing the registers!
After a month's reading the datasheet, you should know what the registers are, and what they do;
Looking at the example code should show how they are used.
In what way did you find the examples "too complicated"?
Thank you for response. Actually in none of the sample codes Registers are directly used. Some buffres pointers ,arrays used. So i can't find where data transmitted and received
If registres directly used it will be easy,I think..
Isn't that the way you'd do it on an 8051?
Think about writing a string to the UART - wouldn't you naturally put the string into a buffer, and then have a function that works through the buffer, sending each character in turn?
Like this:
void main( void ) { uart_init(); printf( "Hello, World!" ); }
Or would you actually write something like this:
void main( void ) { uart_init(); SBUF = 'H'; while( !TI ) /* wait for TI */; SBUF = 'e'; while( !TI ) /* wait for TI */; SBUF = 'l'; while( !TI ) /* wait for TI */; SBUF = 'l'; while( !TI ) /* wait for TI */; SBUF = 'o'; while( !TI ) /* wait for TI */; SBUF = ','; while( !TI ) /* wait for TI */; SBUF = ' '; while( !TI ) /* wait for TI */; SBUF = 'W'; while( !TI ) /* wait for TI */; SBUF = 'o'; while( !TI ) /* wait for TI */; SBUF = 'r'; while( !TI ) /* wait for TI */; SBUF = 'l'; while( !TI ) /* wait for TI */; SBUF = 'd'; while( !TI ) /* wait for TI */; SBUF = '!'; }
Yes I could understand .Let me try with that code. And I thought some problem with my board. I want to confirm one thing that wheather we have connect the port by wire or is it connected in board itself?
What board?
Is what connected to what?
I am using LPC2100 development board. My task is to send two types of data on CAN2 and receive them from CAN1. Data_1 is ADC output which is sent continuously. when EINT1 invoked data_2 send which is high priority.
"I am using LPC2100 development board"
What "LPC2100 development board"? Do you suppose that there is only 1 type of LPC2100 development board in existence anywhere in the whole world?!
And how do you suppose that the data emitted from CAN2 will arrive at CAN1 without any physical connection between the two? Have you looked at the board schematic?
Are you familiar with the basic hardware operation of CAN?