📄 main.lst
字号:
C51 COMPILER V7.06 MAIN 11/19/2003 11:38:14 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 //***************************************************************************
2 //* main.c
3 //* By : Bauke Siderius
4 //* Date : July 2003
5 //* Discription : Using Paul Seerden's I2Cslave code to interact with the
6 //* PCA9564 on the I2C bus
7 //***************************************************************************
8 #include <REG932.H>
9 #include "i2cexprt.h"
10 #include "ua_exprt.h"
11 //***************************************************************************
12 //* Definitions
13 //***************************************************************************
14 typedef unsigned char BYTE;
15 typedef unsigned short WORD;
16 //***************************************************************************
17 //* Functions
18 //***************************************************************************
19 void init(void);
20 PDATA key 0xFF;
*** ERROR C129 IN LINE 20 OF MAIN.C: missing ';' before 'key'
21 //***************************************************************************
22 //* init()
23 //* Input(s) : none.
24 //* Returns : none.
25 //* Description : initialization of P89LPC903
26 //***************************************************************************
27 void init(void)
28 {
29 P0M1 = 0x00; // P0 in Quasi bi mode
30 P1M1 = 0x0C; // P1 in Quasi bi mode
31 P1M2 = 0x0C; // P1.2 P13 open drain
32 P2M1 = 0x00; // P2 in Quasi bi mode
33
34 key = 0xFF;
35 *key = 0x96;
36 }
37 //***************************************************************************
38 //* main()
39 //* Input(s) : none.
40 //* Returns : none.
41 //* Description : main loop
42 //***************************************************************************
43 void main(void)
44 {
45 char temp;
46 init(); // initialize P89LPC932
47 I2C_Init(); // initialize I2C block
48 EA = 1; // enable interrupts
49 while(1) // main loop
50 {
51 switch(slaveBuf[0]) // switch on first byte received
52 {
53 case(0x00): // Command 00, write byte to P2
54 {
C51 COMPILER V7.06 MAIN 11/19/2003 11:38:14 PAGE 2
55 P2 = slaveBuf[1];
56 }
57 break;
58 case(0xEE): // command EE, change address
59 { // acording jumper settings
60 temp = P0;
61 temp &= 0x07; // mask out non address bits
62 temp <<= 1; // shift left one
63 I2ADR = (0xE0 | temp); // generate I2C address depending on P0
64 }
65 break;
66 case(0xFF): // command FF, send back I2C slave address
67 {
68 slaveBuf[0] = I2ADR;
69 }
70 break;
71 default:
72 {
73 }
74 break;
75 }
76 }
77 }
C51 COMPILATION COMPLETE. 0 WARNING(S), 1 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -