📄 paldemo.cp
字号:
PAL_constWrite(10, 0, "\xBA \xBA \xBA", 0x11 ) ;
PAL_constWrite(11, 0, "\xCC\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCA\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xB9", 0x11 ) ;
PAL_constWrite(12, 0, "\xBA \xBA", 0x11 ) ;
PAL_constWrite(13, 0, "\xBA \xBA", 0x11 ) ;
PAL_constWrite(14, 0, "\xBA \xBA", 0x11 ) ;
PAL_constWrite(15, 0, "\xC8\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBC", 0x11 ) ;
PAL_write(4, 3, "H :", 0x21 ) ;
PAL_constWrite(12, 3, "TEMP. : ", 0x31) ;
PAL_constWrite(12, 17, "\xf8C", 0x31) ;
for(ss = 0 ; ss < 60 ; ss++)
{
sx = 90 - (cosE3(90 + 6 * ss) * 28 ) / 1000 ;
sy = 60 - (sinE3(90 + 6 * ss) * 28 ) / 1000 ;
PAL_setPixel(sx, sy, 1 ) ;
if((ss % 5) == 0)
{
PAL_setPixel(sx + 1, sy, 1 ) ;
PAL_setPixel(sx - 1, sy, 1 ) ;
PAL_setPixel(sx, sy + 1, 1 ) ;
PAL_setPixel(sx, sy - 1, 1 ) ;
}
}
}
if(PAL_frameCtr > OldCtr)
{
unsigned char h ;
oldCtr = PAL_frameCtr + 24 ;
Time_EpochToDate(secOffset + PAL_frameCtr / 25, &ts) ;
#line 228 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
sx = 90 - (cosE3(90 + 6 * ts.ss) * 25 ) / 1000 ;
sy = 60 - (sinE3(90 + 6 * ts.ss) * 25 ) / 1000 ;
mx = 90 - (cosE3(90 + 6 * ts.mn) * 20 ) / 1000 ;
my = 60 - (sinE3(90 + 6 * ts.mn) * 20 ) / 1000 ;
h = (ts.hh % 12) * 5 + (ts.mn / 8) ;
hx = 90 - (cosE3(90 + 6 * h) * 15 ) / 1000 ;
hy = 60 - (sinE3(90 + 6 * h) * 15 ) / 1000 ;
if((hx != ohx) || (hy != ohy))
{
PAL_line( 90 , 60 , ohx, ohy, 0 ) ;
}
if((mx != omx) || (my != omy))
{
PAL_line( 90 , 60 , omx, omy, 0 ) ;
}
if((sx != osx) || (sy != osy))
{
PAL_line( 90 , 60 , osx, osy, 0 ) ;
}
PAL_line( 90 , 60 , hx, hy, 1 ) ;
PAL_line( 90 , 60 , mx, my, 1 ) ;
PAL_line( 90 , 60 , sx, sy, 1 ) ;
#line 257 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
char2str(str, ts.ss, 0) ;
PAL_write(4, 7, str, 0x21 ) ;
char2str(str, ts.mn, 0) ;
PAL_write(4, 4, str, 0x21 ) ;
char2str(str, ts.hh, 1) ;
PAL_write(4, 1, str, 0x21 ) ;
PAL_constWrite(6, 2, wdayStr[ts.wd], 0x11 ) ;
PAL_constWrite(7, 2, monthStr[ts.mo], 0x21 ) ;
char2str(str, ts.md, 1) ;
PAL_write(6, 5, str, 0x32) ;
wordToStr(ts.yy, str) ;
PAL_write(9, 1, str + 1, 0x22 ) ;
#line 278 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
osx = sx ;
osy = sy ;
omx = mx ;
omy = my ;
ohx = hx ;
ohy = hy ;
t = degRef - Adc_Read(4) ;
t *= 221 ;
t /= 102 ;
t = 25 + t ;
#line 294 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
if(t < -99)
{
t = -99 ;
}
if(t > 99)
{
t = 99 ;
}
#line 306 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
degHisto[tIdx] = t ;
tIdx++ ;
if(tIdx == 16 )
{
tIdx = 0 ;
}
t = 0 ;
for(i = 0 ; i < 16 ; i++)
{
t += degHisto[i] ;
}
t /= 16 ;
#line 322 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
if(t < 0)
{
i = -t ;
PAL_constWrite(12, 11, "-", 0x31) ;
}
else
{
i = t ;
PAL_constWrite(12, 11, " ", 0x31) ;
}
char2str(str, i, 1) ;
PAL_write(12, 12, str, 0x32) ;
}
PAL_control( 1 , 1 ) ;
}
#line 342 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
void interrupt(void)
{
#line 347 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
PAL_ISR() ;
}
#line 353 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
void main(void)
{
unsigned char i ;
#line 360 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
ADCON1 = 0x0f ;
TRISA = 0xff ;
PORTA = 0 ;
TRISB = 0xff ;
PORTB = 0 ;
TRISC = 0xff ;
PORTC = 0 ;
TRISD = 0 ;
PORTD = 0 ;
TRISE = 0 ;
PORTE = 0 ;
degRef = EEPROM_read(0) ;
#line 381 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
ts.ss = 0 ;
ts.mn = 0 ;
ts.hh = 12 ;
ts.md = 1 ;
ts.mo = 1 ;
ts.yy = 2007 ;
secOffset = Time_dateToEpoch(&ts) ;
#line 393 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
PAL_init( 128 ) ;
PAL_fill(0) ;
PAL_picture(0, 0, logo_bmp, 128, 128) ;
PAL_control( 1 , 1 ) ;
i = 0 ;
while(PORTB == 0)
{
#line 404 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
if(PAL_frameCtr > 12)
{
PAL_setBorder(i) ;
i = !i ;
PAL_frameCtr = 0 ;
}
}
PAL_setBorder( 0 ) ;
drawScreen(1, 0 ) ;
for(;;)
{
if(PORTB & 0b1111111)
{
Time_EpochToDate(secOffset + PAL_frameCtr / 25, &ts) ;
#line 424 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
if(PORTB.F0)
{
adjust(&ts.mn, 0, 59) ;
ts.ss = 0 ;
}
if(PORTB.F1)
{
adjust(&ts.hh, 0, 59) ;
ts.ss = 0 ;
}
if(PORTB.F2)
{
adjust(&ts.md, 1, 31) ;
}
if(PORTB.F3)
{
adjust(&ts.mo, 1, 12) ;
}
if(PORTB.F4)
{
if(PORTB.F7) ts.yy-- ; else ts.yy++ ;
}
secOffset = Time_dateToEpoch(&ts) ;
#line 452 "C:/Users/aykut/Documents/Proje/PIC/pic_pal_tv/PALdemo.c"
if(PORTB.F5)
{
if(PORTB.F7)
{
degRef-- ;
EEPROM_write(0, degref) ;
}
else
{
degRef++ ;
EEPROM_write(0, degref) ;
}
}
while(PORTB & 0b1111111) ;
PAL_frameCtr = 0 ;
oldCtr = 0 ;
}
drawScreen(0, 1 ) ;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -