Author Topic: Uart0Receive vs UartReceive with RaiseEvent  (Read 345 times)

Sigfox16

  • Newbie
  • *
  • Posts: 6
    • View Profile
Uart0Receive vs UartReceive with RaiseEvent
« on: April 06, 2017, 09:12:16 am »
I'm using the UART instance on the McDemo205 to communicate with an external device.  I have managed to get this to work somewhat inspite of the FTDI connection I use with McStudio (not using the WiFi debug yet.)  My question is:  The Uart0Receive can operate as an event however I've had less success using this than creating an instance which is just a raised event.  My question is: What does Uart0Receive assume and can I use it with an external UART (e.g. Pin0, Pin1 as Rx, Tx) successfully?

Also, I was not able to figure out how to use RXD and TXD when booting in uart.create.  These pins names were not recognized.
Hoping to demystify some of the UART capabilities and features with your advice.

Thx, DB=SF16

Share on Facebook Share on Twitter


mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Uart0Receive vs UartReceive with RaiseEvent
« Reply #1 on: April 06, 2017, 11:07:47 am »
The processor has only one serial port and if it is used for debugging it cannot be used to connect something else. If you use wireless debugging you can use the serial port. The serial port can be connected to every pin. With the function UART(baudrate, txPin, rxPin) you just connect the TX and RX pin to UART peripheral.
Have a look at the example in the manual Chapter UART (12.2)

Sigfox16

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Uart0Receive vs UartReceive with RaiseEvent
« Reply #2 on: April 10, 2017, 09:36:44 am »
Thanks for the reply. 

On the McDemo205 there are 2 pins labeled TXD, and RXD.

Q: How do I use map these pins to the Physical UART?

Entering the below generates an error: TXD is not a shared member

Shared Event Boot
     ser = Uart.Create(9600, Pin.TXD, Pin.RXD)
End Event

OR 
    ser=Uart.Create(9600, TXD, RXD)


Returns "variable undeclared."  (How would RXD/TXD be declared mapped  to a pin identity?)

Thanks again, DB