1Copyright Cirrus Logic, Inc. 1999(All Rights Reserved)P.O. Box 17847, Austin, Texas 78760(512) 445 7222 FAX: (512) 445 7581http://www.cirrus.comA
AN11810 AN118REV2sbit SCLK = 0x93 ; /* Serial Clock */sbit A1 = 0x94 ; /* Latch Input */sbit A0 = 0x95 ; /* Latch Input */sbit RESET = 0x
AN118AN118REV2 11sbit PX1 = 0xBA;sbit PT0 = 0xB9;sbit PX0 = 0xB8;/* P3 */sbit RD = 0xB7;sbit WR = 0xB6;sbit T1 = 0xB5;sbit T0
AN11812 AN118REV2/**************************************************************//* Routine - Main *//* Input - none *//* Output - none
AN118AN118REV2 13P3 = 0xFF; /*Use the alternative function of Port 3*/EA = 0x00; /*Disable all interrupts*/SCON = 0x72; /*8 bit UAR
AN11814 AN118REV2/**************************************************************//* Routine - read_register *//* Input - command *//* Outpu
AN118AN118REV2 15case 0x11: /* Offset Register Physical Channel 2 */case 0x21: /* Offset Register Physical Channel 3 */case 0x31: /* Of
AN11816 AN118REV2/**********************//* Read from Register *//**********************/case 0x09: /* Offset Register Physical Channel 1 */case
AN118AN118REV2 17low_byte = receive_byte();TXSER(low_byte); /* Return bytes to PC */TXSER(mid_byte); TXSER(high_byte);}if (temp1
AN11818 AN118REV2case 0xA0: /* Normal Conversion on Setup 5 */case 0xA8: /* Normal Conversion on Setup 6 */case 0xB0: /* Normal Conversion
AN118AN118REV2 19case 0xC2: /* Self-Gain Cal on Setup 9 */case 0xCA: /* Self-Gain Cal on Setup 10 */case 0xD2: /* Self-Gain Cal on Setup 11
AN1182 AN118REV280C51 assembly language, providing a good set oftools for both C and assembly programmers tobuild their own designs upon. While readin
AN11820 AN118REV2case 0xEE: /* System-Gain Cal on Setup 14 */case 0xF6: /* System-Gain Cal on Setup 15 */case 0xFE: /* System-Gain C
AN118AN118REV2 21temp1 = RXSER(); /* Which PC Cal. register is influenced? */decode_sample_index();if(mode == 1) P1 = 0xF4; /* Clear C
AN11822 AN118REV2write_to_register(0x03,0x00,0x00,0x00); /* Clear RS Bit */ } while (temp != 0x40);break;/**********************//* Read Output Latch
AN118AN118REV2 23/********************************//* No Cases were met, let port time out *//********************************/default:break;}}/* END
AN11824 AN118REV2sample_size = 1;break; default:sample_size = 0;break;}} /* END decode_sample_index *//**********************************************
AN118AN118REV2 25elsetoggle_two_leds(); /* Test Failed */break;/* Test Mode 3: This test lights the first two LED and thenrepeatively iniates a conver
AN11826 AN118REV2/* Test Mode 7: This test mode tests the operation ofthe LEDS’s by turning all of them on and off. */case 0x07: toggle_all_leds();b
AN118AN118REV2 27/**************************************************************//* Routine - Delay
AN11828 AN118REV2;****************************************************************;* Routine - transfer_byte;* Input - Byte to be transmitte
AN118AN118REV2 29;****************************************************************;* Routine - RXSER;* Input - none;* Output - Byte rec
AN118AN118REV2 3final byte with its LSB at logic 0 are needed to resetthe serial port). This places the ADC in the com-mand state, where it awaits a v
AN11830 AN118REV2;****************************************************************;* Routine - TXSER;* Input - Byte to be transmitted is pla
• Notes •
AN1184 AN118REV2Figure 4. Write-Cycle TimingFigure 5. Read-Cycle TimingCommand Time8SCLKs8SCLKs Clear SDO FlagData SDO Continuous Conversion ReadSDO
AN118AN118REV2 53.5 Decoding PC CommandsThe decode_command routine is where most of thefunctionality of the program lies. It consists ofmany smaller
AN1186 AN118REV2data is then transferred to the ADC, and SDO ispolled until the conversion is ready. A byte of zerosis then transmitted to the ADC to
AN118AN118REV2 7tines, the user must place the DIP switches backinto the ‘000’ position and reset the evaluationboard. Each of the seven test modes is
AN1188 AN118REV2board, and is entered by setting the DIPs to ‘111’.Immediately upon entering mode 7, thetoggle_all_leds routine is called to blink the
AN118AN118REV2 97. APPENDIX: 80C51 MICROCONTROLLER CODE/*CS5521/22/23/24/28 Runtime Constants and Prototypes*//*PROTOTYPES*/void initialize(void);
Kommentare zu diesen Handbüchern