kasuncharya
Newbie level 5
- Joined
- Jan 25, 2012
- Messages
- 9
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,283
- Location
- Pannala,Sri Lanka
- Activity points
- 1,342
Hi all....,
I want to expand ports of 18F4550 using MCP23S17 , I succeed with 16F877A ,but I wanna do it with 18F4550 . It does not work with 18F.
Pls have a look.
I want to expand ports of 18F4550 using MCP23S17 , I succeed with 16F877A ,but I wanna do it with 18F4550 . It does not work with 18F.
Pls have a look.
// Port Expander module connections
sbit SPExpanderRST at RC0_bit;
sbit SPExpanderCS at RC1_bit;
sbit SPExpanderRST_Direction at TRISC0_bit;
sbit SPExpanderCS_Direction at TRISC1_bit;
// End Port Expander module connections
int j;
void delay(){
Delay_ms(150);
}
void main() {
CMCON = 0x07; // turn off comparators
ADCON1 = 0xFF; // turn off analog inputs
// If Port Expander Library uses SPI1 module
SPI1_Init(); // Initialize SPI module used with PortExpander
Expander_Init(0); // Initialize Port Expander
Expander_Set_DirectionPortA(0, 0x00); // Set Expander's PORTA to be output
for(j=0;j<512;j++){
Expander_Write_PortA(0, 0x09);
delay();
Expander_Write_PortA(0, 0x0C);
delay();
Expander_Write_PortA(0, 0x06);
delay();
Expander_Write_PortA(0, 0x03);
delay();
}
}