Reading PORTB to Terminal
Posted: Sun Jul 21, 2019 3:56 pm
Having trouble peeps... as a noob, I've done the flashing LEDs, the PWM, and the LED on/off by Keyboard inputs. Now I'd like to have a user input i.e. push the little buttons on my dev board and have the pin position sent to terminal.
Here's the code at comments as to what I think it should be doing....
Setup:
EasyPIC V7 board/ICD3/MCC
Using PIC18F45K22/8MHz
XC8/C90
The first bit of text comes onto terminal window fine but no input from the pins...
Any comments would be appreciated.
Regards
Les
Here's the code at comments as to what I think it should be doing....
Setup:
EasyPIC V7 board/ICD3/MCC
Using PIC18F45K22/8MHz
XC8/C90
- Code: Select all
volatile uint8_t rxData;
volatile uint8_t PinData;
void EUSART1_Initialize(void);
{
printf("\r EasyPIC V7 - Date 21/07/2019\r\n");
printf("UART Communications 8-bit Rx and Tx\r\n\n");
printf("Read PORT B Pins \r\n");
printf("using Port B Buttons, set to pull down. \r\n\n");
}
while (1)
{
PinData = PORTB; // save PortB To PinData
__delay_ms(500); // wait for TXREG to fill bit excessive but hey..
if(EUSART1_is_tx_ready()) //if transmit buffer is ready
{
EUSART1_Write(PinData); // send a byte to TX (Terminal from PortB)
}
}
}
The first bit of text comes onto terminal window fine but no input from the pins...
Any comments would be appreciated.
Regards
Les