Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <main.h>
- #include <math.h>
- unsigned int16 temp,a,b;
- #include "convert.c"
- float c,d;
- #int_timer0
- void ngat(void)
- {
- set_timer0(245);
- temp+=1;
- if (temp==1310)
- {
- temp=0;
- output_high(PIN_A0);
- output_high(PIN_A1);
- }
- if(temp== a)
- {
- output_low(PIN_A0);
- }
- if (temp== b)
- {
- output_low(PIN_A1);
- }
- }
- void main()
- {
- setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4|RTCC_8_bit); //1.6 ms overflow
- // enable_interrupts(INT_timer0);
- enable_interrupts(GLOBAL);
- while(TRUE)
- {
- for (c=6;c<=29;c+=0.01)
- {
- d=6*sin(c)+13;
- convert(c,d);
- }
- for (c=29;c>=6;c-=0.01)
- {
- d=6*sin(c)+13;
- convert(c,d);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement