Radio Controlled Timer, Step C

GOAL
  • Send characters to a PC using the 1829 UART

Only transmit, receive will be done later. Sending to PC will help in testing the RTC 1302 added in next step.

Added a 10nF decoupling capacitor to the 1829 as we are using a higher clock frequency.

TX pin changed from default pin RB7 to alternate pin RC4.

A 1k resistor in series with TX prevents any problems with shorts when inserting/removing the 3,5mm plug.

A simple “FTDI”, converts from 3V serial to USB, is used. In this case a Microchip MCP2221 break out box.

Using a terminal program on the PC. I used Realterm.

Communication uses 9600, 8, N, 1.

If you have an Arduino (with serial communication, like Uno) you can use it instead of the MCP2221 break out box. Just make sure you have a sketch downloaded to the Arduino that don’t use the serial communication. The Arduino serial monitor can be used instead of Realterm.

Checking the 1829 datasheet and baud rate tables shows that the 512kHz default clock is way to slow so this has to be changed to at least 4MHz.

Created a subroutine to set clock speed in main and modified the Delay_1s routine to use 3 counters instead.

UART functions in separate .asm and .inc files

Code on Github

Note: When you reprogam the StepC code a number of “SA” appears in terminal with no delay of 1s. This is known Microchip tools behaviour. MPLAB X / Curiosity resets the 1829 a number of times before the programming is done. During these resets 1829  manages to send “SA” before next reset.

EDIT: 2018-10-15
  • Of course, 1829 ICSPDAT and ICSPCLK = pin 19 and pin 18
  • Green LED still connected to RC3, pin 7

Schema changed!

Leave a Reply

Your email address will not be published. Required fields are marked *