اسف لا استخدم المايكرو سي , استخدم ال سي سي اس فقط , حاول ان تفهمه
فهو شبيه بالمايكرو سي
كود:
#include <16F877a.h>
#use delay(clock=4000000)
#include <math.h>
#fuses xt,nowdt,nocpd,nolvp,noprotect
#byte portb=0x06
float theta;
unsigned int8 factor=5,i;
main()
{
set_tris_b(0x00); // set portb as output
while(1)
{
for(i=0;i<=179;i++)
{
theta=theta+=0.0174;
portb=factor*sin(theta);
if(theta>=3.14)
{
goto end;
}
}
end:
theta=0;
delay_us(10);
}
}