Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ========================================
- *
- * Copyright YOUR COMPANY, THE YEAR
- * All Rights Reserved
- * UNPUBLISHED, LICENSED SOFTWARE.
- *
- * CONFIDENTIAL AND PROPRIETARY INFORMATION
- * WHICH IS THE PROPERTY OF your company.
- *
- * ========================================
- */
- #include "project.h"
- #include "stdio.h"
- #include <math.h>
- #include <stdlib.h>
- #include <string.h>
- #include <tm1637.h>
- int main(void)
- {
- ADC_Start();
- UART_Start();
- int x, y, a ,b , c ;
- char string[30];
- CyGlobalIntEnable; /* Enable global interrupts. */
- /* Place your initialization/startup code here (e.g. MyInst_Start()) */
- for(;;)
- {
- ADC_StartConvert();
- ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);
- x=ADC_GetResult16(0);
- int y=ADC_CountsTo_Volts(0,x);
- sprintf(string,"%d\n",x);
- a=(x*5)/127;
- CyDelay(50);
- b=x-(a*100) / 10 ;
- CyDelay(50);
- c= x-(a*100) - (x*10);
- CyDelay(50);
- UART_PutString(string);
- TM1637_clear();
- TM1637_init(1,1);
- TM1637_display_digit(2,a);
- TM1637_display_segments(3, 0b00111110);
- CyDelay(250);
- /* Place your application code here. */
- }
- }
- /* [] END OF FILE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement