Advertisement
RuiViana

PIC 18F4550 LCDRAM

Oct 18th, 2015
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. lcd 16x2 PART NUMBER LCD: MGD1602B-NS(W)-BBS
  2. segue codigo:
  3. #include <18f4550.h>
  4. #device adc=10
  5.  
  6. #FUSES NOWDT //No Watch Dog Timer
  7. #FUSES HS //Crystal osc <= 4mhz
  8. #FUSES PUT //Power Up Timer
  9. #FUSES NOPROTECT //Code not protected from reading
  10. #FUSES NODEBUG //No Debug mode for ICD
  11. #FUSES BROWNOUT //Reset when brownout detected
  12. #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
  13. #FUSES NOCPD //No EE protection
  14.  
  15. #use delay(clock=48000000)
  16.  
  17. #include <lcd.c>
  18.  
  19. int image[8]={
  20. 0b00000,
  21. 0b01110,
  22. 0b00110,
  23. 0b00000,
  24. 0b11111,
  25. 0b11111,
  26. 0b00000,
  27. 0b01111
  28. };
  29. int16 q1,soma;
  30. void main()
  31. {
  32. lcd_init();
  33. setup_adc_ports(AN0);
  34. setup_adc(ADC_CLOCK_DIV_8);
  35. set_adc_channel(0);
  36. delay_us (20);
  37. while (TRUE)
  38. {
  39. q1 = read_adc();
  40. printf (lcd_putc,"\fAD:%ld", q1);
  41. delay_ms (200);
  42.  
  43. // soma = read_EEPROM (0);
  44. if (q1 > 200)
  45. {
  46. soma++;
  47. //write_eeprom(0,soma);
  48. for (int x = 0; x;8;x++)
  49. {
  50. lcd_set_cgram_char(0,image[x]);
  51. }
  52.  
  53. printf(lcd_putc,"eu %c vc",0);
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement