[PIC] SPI commands for PIC18F4550 with ADS1298 slave.

Status
Not open for further replies.
The constants are defined wrongly. Correct C syntax would be

Code:
#define CONFIG3 0x03
instead of 0x03h

I'm also not sure if CONFIG3 is already otherwise defined as processor config register, you could change it to a less ambiguous name like ADC_CONFIG3.
 

You comment about the __delay_ms macro is interesting. I note the XC8 compiler user guide (section 3.5.1) says:
The delay argument
must be a constant and less than approximately 179,200 for PIC18 devices and
approximately 50,659,000 for other devices.
Oh well - whatever works.
Just wondering about the SFR registers not being recognised correctly: what compiler are you using? By the use of the "xc.h" include, I assume it is XC8. Have you specified the PIC18F4550 correctly in the project properties?
As for the syntax error when you use "CONFIG3 etc, you have an extra "h" after the defined text - the lines should read
Code:
#define CONFIG1 0x01
Susan
 

Out of curiosity (I'm a hardware guy).

What is up with the 'h' at the end of all the hex values? I've never seen that type of C syntax before, what does it mean?
Code:
#define CONFIG1 0x01h
#define CONFIG2 0x02h
#define CONFIG3 0x03h
I tried doing a google search on defining hexadecimal values in C but came up empty handed for the use of 'h' at the end of the number.

- - - Updated - - -

Well just saw Susan's & FvM posts (didn't realize there was a 2nd page of posts ), I guess that answers my question. There's more than just that single instance of 'h' used on a hexadecimal value. All of the OPs defines are like that.
 

Well just saw Susan's & FvM posts (didn't realize there was a 2nd page of posts )
I'm embarrassed as well because I hadn't seen FvM's response before I wrote mine.
at89atbits - I'm not able to test out your project file (at work at the moment) but it would appear to be a slightly older version as you have the "CONFIG3" (and other) symbols quoted in the function calls and the "h" at the end of the hex literals. At least the first issue seems to be a backward step on the code you mentioned earlier. Are you sure this is the latest version or have you regressed to an earlier mistake?
However I can see that you are specifying the PIC18F4550 in the project so that answers one of my questions.
Susan
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…