SPI and EB-013 trouble

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
PaulXPC
Posts: 12
Joined: Sun Jun 29, 2008 12:35 pm
Location: The Netherlands
Contact:

SPI and EB-013 trouble

Post by PaulXPC »

Hi guys,

I was planning to do some experiments with SPI, so I got myself the EB-013 SPI board. Loading SPITES~1.HEX in my PIC16F877a gives the results I expected. Having some problems with the flowcode files however:
- when I load the supplied example SPITEST5.fcf in flowcode and save it (unmodified) in a folder on my drive (i.e. c:\test3) and then compile it to the micro; I get lots of C errors. Here's a small sample:

Code: Select all

C:\test3\SPITEST5.c(1300:2): error: unknown identifier 'SetFRAMByte'
C:\test3\SPITEST5.c(2038:14): error: invalid operand '~(1 << ( SPI_FRM_EN))'
C:\test3\SPITEST5.c(2184:22): error: invalid operand 'SPI_DAC_EN'
C:\test3\SPITEST5.c(2184:17): error: failed to generate expression
C:\test3\SPITEST5.c(2184:17): error: invalid operand '<<'
Obviously the compiler is missing some information, so how do I do that?

- The same thing happens when I develop a simple program with the flowcode SPI module. I get a couple of errors like this one:

Code: Select all

C:\Users\Paul\Desktop\test\test2.c(360:4): error: unknown identifier 'SPI_NVM_EN_PORT'
Could anybody please point me in the right direction? Thanks in advance.

Paul

P.S.
I'm using flowcode 3.4.7.48 professional and use the following hardware: HP-488, EB-006 and EB-013.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SPI and EB-013 trouble

Post by Benj »

Hello Paul

Please try the attached file. The example I sent for the test routine was using the macros that were designed before the Flowcode SPI component was completed. The SPI help file should also give you some helpful info on how to configure and use the component macros.
Attachments
SPI Test.fcf
(4.99 KiB) Downloaded 503 times

PaulXPC
Posts: 12
Joined: Sun Jun 29, 2008 12:35 pm
Location: The Netherlands
Contact:

Re: SPI and EB-013 trouble

Post by PaulXPC »

Hello Ben,

Thanks, the supplied code works fine with my 16F877a. Still have a question however; when I want to alter the example for use with a 18F2455, I still get the following error:

Code: Select all

eigen SPI Test.c(346:4): error: unknown identifier 'SPI_NVM_EN_PORT'
eigen SPI Test.c(346:4): error: invalid operand 'SPI_NVM_EN_PORT'
eigen SPI Test.c(346:21): error: failed to generate expression
eigen SPI Test.c(360:4): error: unknown identifier 'SPI_NVM_EN_PORT'
eigen SPI Test.c(360:4): error: invalid operand 'SPI_NVM_EN_PORT'
eigen SPI Test.c(360:21): error: failed to generate expression
eigen SPI Test.c success
I know I can make custom defines, but don't know what defines to use. Could you please help me with this? Thanks in advance.

Paul

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SPI and EB-013 trouble

Post by Benj »

Hello Paul

This problem seems to occur with the chips that have the SPI bus split across 2 ports. Therefore you have a choice as to which port you would like to connect the enable pins for the NVM.

If you go to Edit -> Supplementary code and insert the following into the defines section then your program will compile correctly.

Code: Select all

#define SPI_NVM_EN_PORT portb
Alternativly you could use porta, portc, portd etc if you wish.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: SPI and EB-013 trouble

Post by Benj »

Hello Paul

Attached is a fixed SPI component file that does not have this problem and will not need the extra defines. The enable pin is automatically assigned to portb.

Simply drop the file into your Flowcode V3/Components folder and restart Flowcode.
Attachments
SPI_Code.c
(9.26 KiB) Downloaded 535 times

Post Reply