Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

18F4550 with MCP23S17

Status
Not open for further replies.

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.

// 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();
}

}
 

Attachments

  • 18F.png
    18F.png
    63.1 KB · Views: 70

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top