Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. /**
  2. Generated Main Source File
  3.  
  4. Company:
  5. Microchip Technology Inc.
  6.  
  7. File Name:
  8. main.c
  9.  
  10. Summary:
  11. This is the main file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
  12.  
  13. Description:
  14. This header file provides implementations for driver APIs for all modules selected in the GUI.
  15. Generation Information :
  16. Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.77
  17. Device : PIC16F1827
  18. Driver Version : 2.00
  19. */
  20.  
  21. /*
  22. (c) 2018 Microchip Technology Inc. and its subsidiaries.
  23.  
  24. Subject to your compliance with these terms, you may use Microchip software and any
  25. derivatives exclusively with Microchip products. It is your responsibility to comply with third party
  26. license terms applicable to your use of third party software (including open source software) that
  27. may accompany Microchip software.
  28.  
  29. THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
  30. EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
  31. IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
  32. FOR A PARTICULAR PURPOSE.
  33.  
  34. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
  35. INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
  36. WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
  37. HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
  38. THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
  39. CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
  40. OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
  41. SOFTWARE.
  42. */
  43.  
  44. #include "mcc_generated_files/mcc.h"
  45.  
  46. const char getDAC[] = {0b00000000, 0b00000001, 0b01111111, 0b10000000, 0b10000001, 0b11111111};
  47.  
  48.  
  49. uint8_t dac;
  50.  
  51. /*
  52. Main application
  53. */
  54. void main(void)
  55. {
  56. // initialize the device
  57. SYSTEM_Initialize();
  58.  
  59. // When using interrupts, you need to set the Global and Peripheral Interrupt Enable bits
  60. // Use the following macros to:
  61.  
  62. // Enable the Global Interrupts
  63. //INTERRUPT_GlobalInterruptEnable();
  64.  
  65. // Enable the Peripheral Interrupts
  66. //INTERRUPT_PeripheralInterruptEnable();
  67.  
  68. // Disable the Global Interrupts
  69. //INTERRUPT_GlobalInterruptDisable();
  70.  
  71. // Disable the Peripheral Interrupts
  72. //INTERRUPT_PeripheralInterruptDisable();
  73.  
  74. while (1)
  75. {
  76. if (dac>255){
  77. dac = 0;
  78. }
  79.  
  80. PORTB = dac;
  81. CS_SetHigh();
  82. __delay_ms(1);
  83. CS_SetLow();
  84.  
  85. dac++;
  86. }
  87.  
  88. // Add your application code
  89. }
  90.  
  91. /**
  92. End of File
  93. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement