![Atmel STK511 User Manual Download Page 21](http://html.mh-extra.com/html/atmel/stk511/stk511_user-manual_3003507021.webp)
STK511 Receiver Interface Board
STK511 User Guide
4-7
4842B–AVR–10/09
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:
Toby Prescott
// Date:
03.12.2004
// State:
-
//--------------------------------------------------------------------------
unsigned char WriteLIMITReg(void)
{
//--- 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);
// PortB.4 Output (=Low)
delay_ms(TimeT1);
ClearBit(DDRB,RX_DATA);
// PortB.4 Input (=Open)
// SetBit(PORTB,RX_DATA); // PortB.4 Pullup
delay_us(50);
// Short Delay