Ir ao conteúdo
  • Cadastre-se

Programação do picf16877a


Posts recomendados

PROGRAMAÇÃO DO PICF16877A

Alguém poderia me dar uma dica o porquê o programa abaixo ao ser compilado no MICRO C PRO apresenta as seguintes mensagens:

 

0 1139 Available RAM: 352 [bytes], Available ROM: 8192 [bytes] 

0 127 All files Compiled in 0 ms

0 357 main function is not defined main function is not defined

0 102 Finished (with errors): 21 ago 2016, 11:26:41 MyProject.mcppi

Program original disponivel no site: 0 102 Finished (with errors): 21 ago 2016, 11:26:41 MyProject.mcppi

 

CODICO FONTE:

1.    sbit LCD_RS at RB4_bit;

2.    sbit LCD_EN at RB5_bit;

3.    sbit LCD_D4 at RB0_bit;

4.    sbit LCD_D5 at RB1_bit;

5.    sbit LCD_D6 at RB2_bit;

6.    sbit LCD_D7 at RB3_bit;

7.     

8.    sbit LCD_RS_Direction at TRISB4_bit;

9.    sbit LCD_EN_Direction at TRISB5_bit;

10.   sbit LCD_D4_Direction at TRISB0_bit;

11.   sbit LCD_D5_Direction at TRISB1_bit;

12.   sbit LCD_D6_Direction at TRISB2_bit;

13.   sbit LCD_D7_Direction at TRISB3_bit;

14.    

15.   unsigned long value;

16.   unsigned char d1,d2,d3,d4;

17.    

18.   void Print()

19.   {

20.    Lcd_Out(2,1,"Temperatura: ");

21.    Lcd_Chr_CP(d1+48);

22.    Lcd_Chr_CP(d2+48);

23.    Lcd_chr_CP(d3+48);

24.    Lcd_chr_CP(44);

25.    Lcd_chr_CP(d4+48);

26.   }

27.    

28.   void main()

29.   {

30.    TRISA  = 0xFF;

31.    TRISB  = 0b11000000;

32.    Lcd_Init();

33.    Delay_ms( 100 );

34.    Lcd_Cmd( _LCD_CURSOR_OFF );

35.    Lcd_Out( 1, 3, "MICROCONTROLANDOS" );

36.    

37.   while(1)

38.   {

39.    value = ADC_Read(0);

40.    value = (value*500/1023)*10;

41.    

42.    if (PORTB.F6 == 0 && PORTB.F7 == 0 )

43.    {

44.     d1 = value/1000;

45.     d2 = (value%1000)/100;

46.     d3 = ((value%1000)%100)/10;

47.     d4 = ((value%1000)%100)%10;

48.     Print();

49.     Lcd_chr_CP(223);

50.     Lcd_Out_CP("C");

51.    }

52.    else if(PORTB.F6 == 0 && PORTB.F7 == 1 )

53.    {

54.     value = (value * 1.79) + 32;

55.     d1 = value/1000;

56.     d2 = (value%1000)/100;

57.     d3 = ((value%1000)%100)/10;

58.     d4 = ((value%1000)%100)%10;

59.     Print();

60.     Lcd_chr_CP(223);

61.     Lcd_Out_CP("F");

62.    }

63.    else if( PORTB.F6 == 1 && PORTB.F7 == 0 )

64.    {

65.     value =  value + 273;

66.     d1 = value/1000;

67.     d2 = (value%1000)/100;

68.     d3 = ((value%1000)%100)/10;

69.     d4 = ((value%1000)%100)%10;

70.     Print();

71.     Lcd_Out_CP("K");

72.    }

73.    else

74.    {

75.     value = (value * 1.8)+ 32 + 460;

76.     d1 = value/1000;

77.     d2 = (value%1000)/100;

78.     d3 = ((value%1000)%100)/10;

79.     d4 = ((value%1000)%100)%10;

80.     Print();

81.     Lcd_chr_CP(223);

82.     Lcd_Out_CP("R");

83.    }

84.    

85.    Delay_ms(20);

86.    }

87.   }

 

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...