Port Expander and MikroBUS

General discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
Bill Legge
Posts: 235
Joined: 28 Oct 2007 03:16
Location: West Australia

Port Expander and MikroBUS

#1 Post by Bill Legge » 08 Jun 2023 10:18

I'm using:
1. Mikromedia_Plus Smart Display.
2. Mikromedia+ Shield with the four mikro BUS sockets.
And need some advice on using the Port Expander MCP23S17 that is on the smart display.
To set up a click board I usually define the pin allocation with something like:
sbit TTS_RDY at RE8_bit;
sbit TTS_RDY_DIR_BIT at TRISE8_bit;

But on the shield some of the pins are connnected to the port expander. For example, on BUS1:
PWM pin - GPB0
INT - GPB4

I know how to use the port expander. For example:
// Port Expander module connections
sbit SPExpanderRST at LATB4_bit;
sbit SPExpanderCS at LATA1_bit;
sbit SPExpanderRST_Direction at TRISB4_bit;
sbit SPExpanderCS_Direction at TRISA1_bit;
SPI1_Init(); // master, 8bit,S_clk/64
Expander_Init(0); // initialize Port Expander hardware address is 0
// set Expanders PORT A and B direction. 1=input 0=0utput
Expander_Set_DirectionPortA(0, 0x00); // Set Expander's PORTA to be output
Expander_Set_DirectionPortB(0, 0xFF); // Set Expander's PORTB to be input
Expander_Set_PullUpsPortB(0,0xFF); // Set pull-ups to all of the Expander's PORTB pins


How do I change sbit TTS_RDY at RE8_bit; into something on the port expander?

Many thanks for any advice
Regards Billl Legge in Australia

Post Reply

Return to “mikroC PRO for PIC32 General”