Nai 's depot

Thursday, June 5, 2014

C-programming AVR-Timer

XMEGA-A1 XPLAINED

Use the code shown to figure out the Peripheral Clock that drives the timer if it's not obvious or you don't want to read the manual.

The peripheral clock on the XMEGA-A1-XPLAINED can be driven by 5 different clock sources and it can be scaled 3 times before it gets to the timer module.

By default the clock = 2 MHz and all prescaler are set to 1.


To set the desired time:
            1) change the 16 bit timer period (TCC0.PER),
            2) change the clock scaling (TC_CLKSEL_DIVx_gc)


















RS485 Tranceiver

RS485 Module
Cheap RS485 module can be bought on ebay for about $1.  It uses a MAX485 IC that is rated for 15KV ESD protection and that has all the required termination.  It does not hurt to add more protection to the RS485 lines.  VCC=5V

RS485 Tranceiver