Sample Software - Atmel STK511 User Manual

Avr-based uni-directional radio starter kit
Hide thumbs Also See for STK511:
Table of Contents

Advertisement

When the Configure button is pressed, several things occur. First, the actual settings of the DIP Switches
are checked by reading ports A, C, and D. The settings are then programmed into the receiver according
to the Atmel bi-directional, one-wire interface protocol. The serial programming sequence is repeated
twice for each of the registers. Verification of the programmed data is accomplished by checking for the
presence of an acknowledge pulse. An acknowledge pulse occurs when the data written into the register
is the same as the data already in the register. Lastly the receiver is held in polling mode with a sleep
time defined by the register setting.
4.3.2

Sample Software

Below is a sample of the STK511 Receiver Interface Board Firmware that shows how to write to the
LIMIT register.
//--------------------------------------------------------------------------
// Procedure: WriteLIMITReg
// Function: Write register-value from EEProm to RX
// Author:
// Date:
// State:
//--------------------------------------------------------------------------
unsigned char WriteLIMITReg(void)
{
STK511 User Guide
Toby Prescott
03.12.2004
-
//--- Local Variabledeclaration:
unsigned char cBitPos; // Pointer to the current bit
unsigned char cTempByte;
unsigned int iQuit = 0;
char eeprom *e_eeprom_ptr;
//--- Write the LIMIT register into the receiver:
while(!iQuit)
{
e_eeprom_ptr = &e[2];
// Point to the fourth byte of memory (LSB of LIMIT)
//--- Send the programming start pulse (t1) to the Receiver:
ClearBit(PORTB,RX_DATA); // PortB.4 Low
SetBit(DDRB,RX_DATA);
delay_ms(TimeT1);
ClearBit(DDRB,RX_DATA);
//
SetBit(PORTB,RX_DATA); // PortB.4 Pullup
delay_us(50);
// PortB.4 Output (=Low)
// PortB.4 Input (=Open)
// Short Delay
STK511 Receiver Interface Board
4842B–AVR–10/09
4-7

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STK511 and is the answer not in the manual?

Questions and answers

Table of Contents