??? 08/13/07 15:53 Read: times |
#143178 - Programming in C# |
Hi, iam a beguinner on writing program in C# language. I'm having problems when i try to run the program using the softwate Keil. I follow the steps which one of them is to select the device at89s8253 and I put my program and when i run it reports a buch of errors on the output window.
The program starts like this: Thank you very much and sorry for not understanding that well! #ifndef __AT89S8253_H__ #define __AT89S8253_H__ #define SDA P1_5 // Pino SDA do barramento I2C #define SCL P1_6 // Pino SCL do barramento I2C #define pcf_addr 0x94 // Endereco I2C do PCF8591 #define config_DA 0x40 // configuracao para D/A #define config_AD 0x00 // configuracao para D/A void timer(char vezes) { while(vezes) { TMOD=0x01; // TIMER 0 - modo 1 ( 16 bits) TH0=~(1000/256); // atribui o valor 0x15h, figura 1.12 TL0=-(1000%256); // atribui o valor 0x9Fh, figura 1.12 TR0=1; // seta o flag TR0 dando início à contagem TF0=0; while(!TF0); // espera término da contagem vezes--; // decrementa a variável vezes - //determina 60ms x 2! } } void start() { SDA=SCL=1; // atribui nível lógico 1 aos ports SDA=0; _asm nop // 1 us nop // 1 us nop // 1 us nop // 1 us nop // 1 us _endasm; SCL=0; } void stop() { SDA=0; SCL=1; _asm nop // 1 us nop // 1 us nop // 1 us nop // 1 us nop // 1 us _endasm; SDA=1; } char clock() { char level; SCL=1; level=SDA; SCL=0; return(level); } char write(unsigned char byte) { unsigned char mask=0x80; unsigned char controle=0; while(mask) { if(byte & mask)SDA=1; else SDA=0; SCL=1; mask>>=1; //enquanto espera SCL chegar em nível '1', rotaciona mask SCL=0; } SDA=1; SCL=1; controle=SDA; SCL=0; return(controle); // ack from D/A } char read(char ack) { unsigned char mask=0x80, byte=0x00; while(mask) { if(clock()) byte|=mask; mask>>=1; } if(ack) { SDA=0; clock(); SDA=1; } else { SDA=1; clock(); } return(byte); } char PCF8591(unsigned char addr, unsigned char mod, unsigned char conf) // conf = [1] leitura / [0] escrita { char status=0; unsigned char temp; temp=(addr+mod); start(); if(!write(temp)) if(!mod) { if(!write(conf)) status=1; } else status=1; return(status); // retorna valor para controle } void main() { unsigned char value; unsigned char temp; unsigned int cont; value=0x00; while(1) { while(!(PCF8591(pcf_addr,1,0x40)));// configurado para leitura temp=read(1); stop(); timer(100); while(!(PCF8591(pcf_addr,0,config_DA)));// configurado para escrita write(temp); stop(); timer(100); } } The error on the output window follows: Build target 'Target 1' assembling STARTUP.A51... compiling programa#1.C... PROGRAMA#1.C(13): error C202: 'TMOD': undefined identifier PROGRAMA#1.C(14): error C202: 'TH0': undefined identifier PROGRAMA#1.C(15): error C202: 'TL0': undefined identifier PROGRAMA#1.C(16): error C202: 'TR0': undefined identifier PROGRAMA#1.C(17): error C202: 'TF0': undefined identifier PROGRAMA#1.C(18): error C202: 'TF0': undefined identifier PROGRAMA#1.C(24): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(25): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(27): error C202: '_asm': undefined identifier PROGRAMA#1.C(27): error C141: syntax error near 'nop' PROGRAMA#1.C(33): error C202: 'P1_6': undefined identifier PROGRAMA#1.C(36): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(37): error C202: 'P1_6': undefined identifier PROGRAMA#1.C(39): error C202: '_asm': undefined identifier PROGRAMA#1.C(39): error C141: syntax error near 'nop' PROGRAMA#1.C(45): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(49): error C202: 'P1_6': undefined identifier PROGRAMA#1.C(50): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(51): error C202: 'P1_6': undefined identifier PROGRAMA#1.C(58): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(59): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(60): error C202: 'P1_6': undefined identifier PROGRAMA#1.C(62): error C202: 'P1_6': undefined identifier PROGRAMA#1.C(64): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(65): error C202: 'P1_6': undefined identifier PROGRAMA#1.C(66): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(67): error C202: 'P1_6': undefined identifier PROGRAMA#1.C(78): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(80): error C202: 'P1_5': undefined identifier PROGRAMA#1.C(83): error C202: 'P1_5': undefined identifier Target not created |
Topic | Author | Date |
Programming in C# | 01/01/70 00:00 | |
looks like C to me | 01/01/70 00:00 | |
Me too! | 01/01/70 00:00 | |
Thanks! | 01/01/70 00:00 | |
Back to basics! | 01/01/70 00:00 | |
project! | 01/01/70 00:00 | |
Have you discussed this with your supervisor(s)? | 01/01/70 00:00 | |
Problem! | 01/01/70 00:00 | |
no problem | 01/01/70 00:00 | |
know problem | 01/01/70 00:00 | |
correct | 01/01/70 00:00 | |
re: thanks | 01/01/70 00:00 | |
Read what the message tells you! | 01/01/70 00:00 | |
not Keil C | 01/01/70 00:00 | |
the Nops | 01/01/70 00:00 | |
Gee .. I thought that was for BIG prorgams. | 01/01/70 00:00 | |
Gee.that is a big problem but im not at that level | 01/01/70 00:00 |