Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
software_uart.pde
08-05-2017, 09:58 AM,
#1
software_uart.pde
Hello,
I am trying to compile the software_uart.pde from the example folder. It calls functions such as SwSerial.read()
IDE 11.0 beta 4
I am getting error during compilation.

[OUT] ERROR: 255: Undefined identifier 'PORTBbits'
[OUT] 255: Structure/Union expected left of '.->'
[OUT] 256: Undefined identifier 'PORTBbits'
[OUT] 256: Structure/Union expected left of '.->'
[OUT] 310: Undefined identifier 'PORTBbits'
[OUT] 310: Structure/Union expected left of '.->'
[OUT] 312: Undefined identifier 'PORTBbits'
[OUT] 312: Structure/Union expected left of '.->'
[OUT] 327: Undefined identifier 'PORTBbits'
[OUT] 327: Structure/Union expected left of '.->'

Could some body help me with this errors?
Thanks for your help.


#define SWBAUDRATE 9600// or 57600, 38400, 19200, 9600, 4800
// other baudrates 115200 2400 1200 were tried but did not work perfectly
#define _SW_PORT _PORTB // Transmit pin port and pin
#define TXDpin 4 // or 0, 2, 6
#define RXDpin 5 // or 1, 3, 7
#define SW_PORT_TXDpin PORTBbits.RB4 // or 0, 2, 6
#define SW_TRIS_TXDD TRISBbits.TRISB4 // or 0, 2, 6
#define SW_PORT_RXDpin PORTBbits.RB5 // or 1, 3, 7
#define SW_TRIS_RXDD TRISBbits.TRISB5 // or 1, 3, 7
char buf;
void setup() {
SW_TRIS_TXDD = 0;
SW_PORT_TXDpin = 1;

SW_TRIS_RXDD = 1;

SwSerial.putString("Hello !\n\r");//putString replaceable by printf
SwSerial.printf("Enter your name or everything you want : ");//putsUART
}

void loop() {
buf=SwSerial.read();
// SwSerial.write(buf); //write replaceable by printf :
SwSerial.printf("%c",buf);

}
Reply
08-05-2017, 04:55 PM,
#2
RE: software_uart.pde
Hello,
You have to modify the file main.c in \pinguino\v11\user\source :
lines 38-43 
////////////////////////////////////////////////////////////////////////
#include <compiler.h>       // SDCC / XC8 compatibility
#include "define.h"
////////////////////////////////////////////////////////////////////////

//#include <typedef.h>

that is to say #include <compiler.h> has to be moved before #include "define.h".
It is the reason why PORTBbits.RB4 (or 5) is not recognized.
André
Reply
09-05-2017, 04:18 PM,
#3
RE: software_uart.pde
(08-05-2017, 04:55 PM)gtcbreizh Wrote: Hello,
You have to modify the file main.c in \pinguino\v11\user\source :
lines 38-43 
////////////////////////////////////////////////////////////////////////
#include <compiler.h>       // SDCC / XC8 compatibility
#include "define.h"
////////////////////////////////////////////////////////////////////////

//#include <typedef.h>

that is to say #include <compiler.h> has to be moved before #include "define.h".
It is the reason why PORTBbits.RB4 (or 5) is not recognized.
André
Reply
09-05-2017, 04:20 PM,
#4
RE: software_uart.pde
Thanks Andre, I have applied the suggested changes and it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)