Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. /*
  2. * File: Anzeige Temperatur (IPA 2017)
  3. * Author: Bregy Yannik
  4. *
  5. * Created on 24. März 2017, 09:34
  6. */
  7. #include <16LF1518.h>
  8.  
  9. #use delay (clock=20000000)
  10. #fuses HS,NOWDT,NOPROTECT,NOLVP
  11. #include "LCD.c"
  12.  
  13.  
  14. #byte Port_A = 0x00C //Poti und Switch
  15. #byte Port_B = 0x00D //Poti und Switch
  16. #byte Port_C = 0x00E
  17. #byte TRISA = 0x08C
  18. #byte TRISB = 0x08D
  19. #byte TRISC = 0x08E
  20.  
  21. //#ifndef LCD_PORTS
  22. //#define LCD_PORTS
  23. #bit RB1 = Port_B.1
  24. #bit RB2 = Port_B.2
  25. #bit RB3 = Port_B.3
  26.  
  27. #bit RC0 = Port_B.0
  28. #bit RC1 = Port_B.1
  29. #bit RC2 = Port_C.2
  30. #bit RC3 = Port_C.3
  31. #bit RC4 = Port_C.4
  32. #bit RC5 = Port_C.5
  33. #bit RC6 = Port_C.6
  34. #bit RC7 = Port_B.7
  35.  
  36. /*
  37. int Anzeige[10]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09};
  38. int16 Wert_TypK;
  39. int16 Wert_TypJ;
  40. int16 einer = 0;
  41. int16 zehner = 0;
  42. int16 hundert = 0;
  43. int16 temp_TypK = 0;
  44. int16 temp_TypJ = 0;
  45. int16 AD_Wert_TpyK;
  46. int16 AD_Wert_TypJ;
  47. int16 x = 0;
  48. float f = 1.96;
  49. float d = 15;
  50. */
  51.  
  52. void ini();
  53.  
  54. ini();
  55.  
  56. lcd_init();
  57.  
  58.  
  59.  
  60. void Function_set();
  61.  
  62. void Display_on();
  63.  
  64. void Display_clear();
  65.  
  66. void Entry_mode();
  67.  
  68. void write_data();
  69.  
  70. void main()
  71. {
  72. while(TRUE)
  73. {
  74. }
  75. }
  76. void Function_set()
  77. {
  78. RB1 = 0;
  79. RB2 = 0;
  80. RB3 = 0;
  81. RC0 = 0;
  82. RC1 = 0;
  83. RC2 = 1;
  84. RC3 = 1;
  85. RC4 = 1;
  86. RC5 = 1;
  87. RC6 = 0;
  88. RC7 = 0;
  89. delay_us(37);
  90. }
  91.  
  92. void Display_on()
  93. {
  94. Port_B = 0b00000000;
  95. Port_C = 0b00001100;
  96. delay_us(37);
  97. }
  98.  
  99. void Display_clear()
  100. {
  101. Port_B = 0b00000000;
  102. Port_C = 0b00000001;
  103. delay_ms(2);
  104. }
  105.  
  106. void Entry_mode()
  107. {
  108. Port_B = 0b00000000;
  109. Port_C = 0b00000110;
  110. }
  111.  
  112. void write_data()
  113. {
  114. Port_C = 0b01000000;
  115. delay_us(37);
  116. Port_B = 0b00000010;
  117. lcd_gotoxy(1, 00); // Go to column 4 row 1
  118. lcd_putc(0x31);
  119. }
  120.  
  121. void ini()
  122. {
  123. TRISA = 0b101000; // A Output und Input
  124. TRISB = 0b00000000; // B Output
  125. TRISC = 0b00000000;
  126. setup_adc(ADC_CLOCK_INTERNAL);
  127. set_adc_channel(3);
  128. // setup_adc_ports(ALL_ANALOG);
  129. setup_adc_ports(sAN3 VSS_VDD);
  130. // setup_lcd( LCD_MUX14 | LCD_STOP_ON_SLEEP, 2, ALL_LCD_PINS );
  131.  
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement