⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calvol.p1

📁 采用PICC18编写的单片机源代码
💻 P1
📖 第 1 页 / 共 4 页
字号:

"515
[v _LATA1 `VNb 1 e@31817 ]
[; ;pic18fxx2.h: 515: volatile near bit LATA1 @ ((unsigned)&LATA*8)+1;

"516
[v _LATA2 `VNb 1 e@31818 ]
[; ;pic18fxx2.h: 516: volatile near bit LATA2 @ ((unsigned)&LATA*8)+2;

"517
[v _LATA3 `VNb 1 e@31819 ]
[; ;pic18fxx2.h: 517: volatile near bit LATA3 @ ((unsigned)&LATA*8)+3;

"518
[v _LATA4 `VNb 1 e@31820 ]
[; ;pic18fxx2.h: 518: volatile near bit LATA4 @ ((unsigned)&LATA*8)+4;

"519
[v _LATA5 `VNb 1 e@31821 ]
[; ;pic18fxx2.h: 519: volatile near bit LATA5 @ ((unsigned)&LATA*8)+5;

"520
[v _LATA6 `VNb 1 e@31822 ]
[; ;pic18fxx2.h: 520: volatile near bit LATA6 @ ((unsigned)&LATA*8)+6;

"524
[v _RE0 `VNb 1 e@31776 ]
[; ;pic18fxx2.h: 524: volatile near bit RE0 @ ((unsigned)&PORTE*8)+0;

"525
[v _RE1 `VNb 1 e@31777 ]
[; ;pic18fxx2.h: 525: volatile near bit RE1 @ ((unsigned)&PORTE*8)+1;

"526
[v _RE2 `VNb 1 e@31778 ]
[; ;pic18fxx2.h: 526: volatile near bit RE2 @ ((unsigned)&PORTE*8)+2;

"529
[v _RD0 `VNb 1 e@31768 ]
[; ;pic18fxx2.h: 529: volatile near bit RD0 @ ((unsigned)&PORTD*8)+0;

"530
[v _RD1 `VNb 1 e@31769 ]
[; ;pic18fxx2.h: 530: volatile near bit RD1 @ ((unsigned)&PORTD*8)+1;

"531
[v _RD2 `VNb 1 e@31770 ]
[; ;pic18fxx2.h: 531: volatile near bit RD2 @ ((unsigned)&PORTD*8)+2;

"532
[v _RD3 `VNb 1 e@31771 ]
[; ;pic18fxx2.h: 532: volatile near bit RD3 @ ((unsigned)&PORTD*8)+3;

"533
[v _RD4 `VNb 1 e@31772 ]
[; ;pic18fxx2.h: 533: volatile near bit RD4 @ ((unsigned)&PORTD*8)+4;

"534
[v _RD5 `VNb 1 e@31773 ]
[; ;pic18fxx2.h: 534: volatile near bit RD5 @ ((unsigned)&PORTD*8)+5;

"535
[v _RD6 `VNb 1 e@31774 ]
[; ;pic18fxx2.h: 535: volatile near bit RD6 @ ((unsigned)&PORTD*8)+6;

"536
[v _RD7 `VNb 1 e@31775 ]
[; ;pic18fxx2.h: 536: volatile near bit RD7 @ ((unsigned)&PORTD*8)+7;

"540
[v _RC0 `VNb 1 e@31760 ]
[; ;pic18fxx2.h: 540: volatile near bit RC0 @ ((unsigned)&PORTC*8)+0;

"541
[v _RC1 `VNb 1 e@31761 ]
[; ;pic18fxx2.h: 541: volatile near bit RC1 @ ((unsigned)&PORTC*8)+1;

"542
[v _RC2 `VNb 1 e@31762 ]
[; ;pic18fxx2.h: 542: volatile near bit RC2 @ ((unsigned)&PORTC*8)+2;

"543
[v _RC3 `VNb 1 e@31763 ]
[; ;pic18fxx2.h: 543: volatile near bit RC3 @ ((unsigned)&PORTC*8)+3;

"544
[v _RC4 `VNb 1 e@31764 ]
[; ;pic18fxx2.h: 544: volatile near bit RC4 @ ((unsigned)&PORTC*8)+4;

"545
[v _RC5 `VNb 1 e@31765 ]
[; ;pic18fxx2.h: 545: volatile near bit RC5 @ ((unsigned)&PORTC*8)+5;

"546
[v _RC6 `VNb 1 e@31766 ]
[; ;pic18fxx2.h: 546: volatile near bit RC6 @ ((unsigned)&PORTC*8)+6;

"547
[v _RC7 `VNb 1 e@31767 ]
[; ;pic18fxx2.h: 547: volatile near bit RC7 @ ((unsigned)&PORTC*8)+7;

"550
[v _RB0 `VNb 1 e@31752 ]
[; ;pic18fxx2.h: 550: volatile near bit RB0 @ ((unsigned)&PORTB*8)+0;

"551
[v _RB1 `VNb 1 e@31753 ]
[; ;pic18fxx2.h: 551: volatile near bit RB1 @ ((unsigned)&PORTB*8)+1;

"552
[v _RB2 `VNb 1 e@31754 ]
[; ;pic18fxx2.h: 552: volatile near bit RB2 @ ((unsigned)&PORTB*8)+2;

"553
[v _RB3 `VNb 1 e@31755 ]
[; ;pic18fxx2.h: 553: volatile near bit RB3 @ ((unsigned)&PORTB*8)+3;

"554
[v _RB4 `VNb 1 e@31756 ]
[; ;pic18fxx2.h: 554: volatile near bit RB4 @ ((unsigned)&PORTB*8)+4;

"555
[v _RB5 `VNb 1 e@31757 ]
[; ;pic18fxx2.h: 555: volatile near bit RB5 @ ((unsigned)&PORTB*8)+5;

"556
[v _RB6 `VNb 1 e@31758 ]
[; ;pic18fxx2.h: 556: volatile near bit RB6 @ ((unsigned)&PORTB*8)+6;

"557
[v _RB7 `VNb 1 e@31759 ]
[; ;pic18fxx2.h: 557: volatile near bit RB7 @ ((unsigned)&PORTB*8)+7;

"560
[v _RA0 `VNb 1 e@31744 ]
[; ;pic18fxx2.h: 560: volatile near bit RA0 @ ((unsigned)&PORTA*8)+0;

"561
[v _RA1 `VNb 1 e@31745 ]
[; ;pic18fxx2.h: 561: volatile near bit RA1 @ ((unsigned)&PORTA*8)+1;

"562
[v _RA2 `VNb 1 e@31746 ]
[; ;pic18fxx2.h: 562: volatile near bit RA2 @ ((unsigned)&PORTA*8)+2;

"563
[v _RA3 `VNb 1 e@31747 ]
[; ;pic18fxx2.h: 563: volatile near bit RA3 @ ((unsigned)&PORTA*8)+3;

"564
[v _RA4 `VNb 1 e@31748 ]
[; ;pic18fxx2.h: 564: volatile near bit RA4 @ ((unsigned)&PORTA*8)+4;

"565
[v _RA5 `VNb 1 e@31749 ]
[; ;pic18fxx2.h: 565: volatile near bit RA5 @ ((unsigned)&PORTA*8)+5;

"566
[v _RA6 `VNb 1 e@31750 ]
[; ;pic18fxx2.h: 566: volatile near bit RA6 @ ((unsigned)&PORTA*8)+6;

[; ;pic18.h: 293: extern unsigned char eeprom_read(unsigned int address);

[; ;pic18.h: 294: extern void eeprom_write(unsigned int address,unsigned char data);

[; ;pic18.h: 298: extern unsigned char flash_read(unsigned long addr);

[; ;pic18.h: 302: extern void flash_write(const unsigned char *,unsigned int,far unsigned char *);

[; ;pic18.h: 305: extern void flash_erase(unsigned long addr);

[; ;pic18.h: 323: extern unsigned int config_read(unsigned char reg_no);

[; ;pic18.h: 324: extern void config_write(unsigned char reg_no, unsigned int dataword);

[; ;pic18.h: 327: extern unsigned int device_id_read(void);

[; ;pic18.h: 330: extern unsigned char idloc_read(unsigned char reg_no);

[; ;pic18.h: 331: extern void idloc_write(unsigned char reg_no,unsigned char data);

[; ;pic18.h: 334: extern void initiate_write(void);

[; ;pic18.h: 353: extern unsigned char checksum8(unsigned long startAddr, unsigned long length);

[; ;pic18.h: 354: extern unsigned int checksum16(unsigned long startAddr, unsigned long length);

[; ;pic18.h: 355: extern unsigned long checksum32(unsigned long startAddr, unsigned long length);

"17 E:\workall\LAMP2\PICC18\EmerTime\calVol.h
[v F814 `ui -> 2 `i t ]
[v _TableAddrE2EachEmerVolt `F814 -> 4 `i e ]
[i _TableAddrE2EachEmerVolt
:U ..
:U ..
-> + + + + -> 4 `i -> 4 `i -> 8 `i -> 1 `i -> 1 `i `ui
-> + + + + + -> 4 `i -> 4 `i -> 8 `i -> 1 `i -> 1 `i -> 1 `i `ui
..
:U ..
"18
-> + + + + + -> 4 `i -> 4 `i -> 8 `i -> 1 `i -> 1 `i -> 2 `i `ui
-> + + + + + -> 4 `i -> 4 `i -> 8 `i -> 1 `i -> 1 `i -> 3 `i `ui
..
:U ..
"19
-> + + + + + -> 4 `i -> 4 `i -> 8 `i -> 1 `i -> 1 `i -> 4 `i `ui
-> + + + + + -> 4 `i -> 4 `i -> 8 `i -> 1 `i -> 1 `i -> 5 `i `ui
..
:U ..
"20
-> + + + + + -> 4 `i -> 4 `i -> 8 `i -> 1 `i -> 1 `i -> 6 `i `ui
-> + + + + + -> 4 `i -> 4 `i -> 8 `i -> 1 `i -> 1 `i -> 7 `i `ui
..
..
][; ;calVol.h: 17: unsigned int TableAddrE2EachEmerVolt[4][2]={{0x04+4+8+1+1,0x04+4+8+1+1+1},

[; ;calVol.h: 18: {0x04+4+8+1+1+2,0x04+4+8+1+1+3},

[; ;calVol.h: 19: {0x04+4+8+1+1+4,0x04+4+8+1+1+5},

[; ;calVol.h: 20: {0x04+4+8+1+1+6,0x04+4+8+1+1+7}};

"21
[v _baseVolt `ui 1 e ]
[; ;calVol.h: 21: unsigned int baseVolt;

"22
[v _Amp `uc 1 e ]
[; ;calVol.h: 22: unsigned char Amp;

"23
[v F818 `ui -> -> 1 `i `ux t ]
[v _EmerVolt `F818 -> 4 `i e ]
[; ;calVol.h: 23: unsigned int EmerVolt[4][1];

[; ;calVol.h: 24: void SaveEmerVolt(unsigned char chnNo,unsigned int SapDigitial);

[; ;calVol.h: 25: void CalVolt_initial(void);

[; ;calVol.h: 26: void ChangeAmp(void);

[; ;calVol.h: 27: void ChangeBaseVolt(unsigned char digit);

"10 E:\workall\LAMP2\PICC18\EmerTime\calVol.c
[v _CalVolt_initial `(v 1 ef ]
{
[; ;calVol.c: 9: void CalVolt_initial(void)

[; ;calVol.c: 10: {

[e :U _CalVolt_initial ]
[f ]
"11
[v _tmpCtr `uc 1 a ]
[v _tmpCtr2 `uc 1 a ]
[; ;calVol.c: 11: unsigned char tmpCtr,tmpCtr2;

[; ;calVol.c: 12: baseVolt=eeprom_read(0x00)+eeprom_read(0x01)*255;

"293 E:\workall\LAMP2\PICC18\EmerTime\pic18.h
[v _eeprom_read `(uc 0 ef1`ui ]
"12 E:\workall\LAMP2\PICC18\EmerTime\calVol.c
[e = _baseVolt -> + -> ( _eeprom_read (1
 -> -> 0 `i `ui `i * -> ( _eeprom_read (1
 -> -> 1 `i `ui `i -> 255 `i `ui ]
[; ;calVol.c: 13: Amp=eeprom_read(0x04+4+8+1);

"13
[e = _Amp ( _eeprom_read (1
 -> + + + -> 4 `i -> 4 `i -> 8 `i -> 1 `i `ui ]
[; ;calVol.c: 15: for(tmpCtr=0;tmpCtr<4;tmpCtr++)

"15
{
[e = _tmpCtr -> -> 0 `i `uc ]
[e $ < -> _tmpCtr `i -> 4 `i 2  ]
[e $U 3  ]
"16
[e :U 2 ]
[; ;calVol.c: 16: {

{
[; ;calVol.c: 17: EmerVolt[tmpCtr][0]=eeprom_read(TableAddrE2EachEmerVolt[tmpCtr][0])+eeprom_read(TableAddrE2EachEmerVolt[tmpCtr][1])*255;

"17
[e = *U + &U *U + &U _EmerVolt * -> _tmpCtr `ux -> * -> # `ui `ui -> -> -> 1 `i `ux `ui `ux * -> -> -> 0 `i `ui `ux -> -> # *U &U *U + &U _EmerVolt * -> _tmpCtr `ux -> * -> # `ui `ui -> -> -> 1 `i `ux `ui `ux `ui `ux -> + -> ( _eeprom_read (1
 *U + &U *U + &U _TableAddrE2EachEmerVolt * -> _tmpCtr `ux -> * -> # `ui `ui -> -> 2 `i `ui `ux * -> -> -> 0 `i `ui `ux -> -> # *U &U *U + &U _TableAddrE2EachEmerVolt * -> _tmpCtr `ux -> * -> # `ui `ui -> -> 2 `i `ui `ux `ui `ux `i * -> ( _eeprom_read (1
 *U + &U *U + &U _TableAddrE2EachEmerVolt * -> _tmpCtr `ux -> * -> # `ui `ui -> -> 2 `i `ui `ux * -> -> -> 1 `i `ui `ux -> -> # *U &U *U + &U _TableAddrE2EachEmerVolt * -> _tmpCtr `ux -> * -> # `ui `ui -> -> 2 `i `ui `ux `ui `ux `i -> 255 `i `ui ]
"18
}
"15
[e ++ _tmpCtr -> -> 1 `i `uc ]
[e $ < -> _tmpCtr `i -> 4 `i 2  ]
[e :U 3 ]
"18
}
"19
[; ;calVol.c: 18: }

[; ;calVol.c: 19: }

[e :UE 1 ]
}
"27
[v _CalSapVolt `(ui 1 ef1`ui ]
{
[; ;calVol.c: 26: unsigned int CalSapVolt(unsigned int SapDigitial)

[; ;calVol.c: 27: {

[e :U _CalSapVolt ]
[v _SapDigitial `ui 1 r1 ]
[f ]
[; ;calVol.c: 28: return (baseVolt*SapDigitial*Amp/1023);

"28
[e ) / * * _baseVolt _SapDigitial -> _Amp `ui -> -> 1023 `i `ui ]
[e $UE 5  ]
"29
[; ;calVol.c: 29: }

[e :UE 5 ]
}
"36
[v _SaveEmerVolt `(v 1 ef2`uc`ui ]
{
[; ;calVol.c: 35: void SaveEmerVolt(unsigned char chnNo,unsigned int SapDigitial)

[; ;calVol.c: 36: {

[e :U _SaveEmerVolt ]
[v _chnNo `uc 1 r1 ]
[v _SapDigitial `ui 1 r2 ]
[f ]
[; ;calVol.c: 37: EmerVolt[chnNo][0]=CalSapVolt(SapDigitial);

"37
[e = *U + &U *U + &U _EmerVolt * -> _chnNo `ux -> * -> # `ui `ui -> -> -> 1 `i `ux `ui `ux * -> -> -> 0 `i `ui `ux -> -> # *U &U *U + &U _EmerVolt * -> _chnNo `ux -> * -> # `ui `ui -> -> -> 1 `i `ux `ui `ux `ui `ux ( _CalSapVolt (1
 _SapDigitial ]
[; ;calVol.c: 38: eeprom_write(TableAddrE2EachEmerVolt[chnNo][0],((unsigned char)((EmerVolt[chnNo][0])&0Xff)));

"294 E:\workall\LAMP2\PICC18\EmerTime\pic18.h
[v _eeprom_write `(v 0 ef2`ui`uc ]
"38 E:\workall\LAMP2\PICC18\EmerTime\calVol.c
[e ( _eeprom_write (2
 , *U + &U *U + &U _TableAddrE2EachEmerVolt * -> _chnNo `ux -> * -> # `ui `ui -> -> 2 `i `ui `ux * -> -> -> 0 `i `ui `ux -> -> # *U &U *U + &U _TableAddrE2EachEmerVolt * -> _chnNo `ux -> * -> # `ui `ui -> -> 2 `i `ui `ux `ui `ux -> & *U + &U *U + &U _EmerVolt * -> _chnNo `ux -> * -> # `ui `ui -> -> -> 1 `i `ux `ui `ux * -> -> -> 0 `i `ui `ux -> -> # *U &U *U + &U _EmerVolt * -> _chnNo `ux -> * -> # `ui `ui -> -> -> 1 `i `ux `ui `ux `ui `ux -> -> 255 `i `ui `uc ]
[; ;calVol.c: 39: eeprom_write(TableAddrE2EachEmerVolt[chnNo][1],((unsigned char)((EmerVolt[chnNo][0])>>8)));

"39
[e ( _eeprom_write (2
 , *U + &U *U + &U _TableAddrE2EachEmerVolt * -> _chnNo `ux -> * -> # `ui `ui -> -> 2 `i `ui `ux * -> -> -> 1 `i `ui `ux -> -> # *U &U *U + &U _TableAddrE2EachEmerVolt * -> _chnNo `ux -> * -> # `ui `ui -> -> 2 `i `ui `ux `ui `ux -> >> *U + &U *U + &U _EmerVolt * -> _chnNo `ux -> * -> # `ui `ui -> -> -> 1 `i `ux `ui `ux * -> -> -> 0 `i `ui `ux -> -> # *U &U *U + &U _EmerVolt * -> _chnNo `ux -> * -> # `ui `ui -> -> -> 1 `i `ux `ui `ux `ui `ux -> 8 `i `uc ]
"40
[; ;calVol.c: 40: }

[e :UE 6 ]
}
"48
[v _SaveBaseVolt `(v 1 ef1`ui ]
{
[; ;calVol.c: 47: void SaveBaseVolt(unsigned int newBaseVolt)

[; ;calVol.c: 48: {

[e :U _SaveBaseVolt ]
[v _newBaseVolt `ui 1 r1 ]
[f ]
[; ;calVol.c: 49: baseVolt=newBaseVolt;

"49
[e = _baseVolt _newBaseVolt ]
[; ;calVol.c: 50: eeprom_write(0x00,((unsigned char)((baseVolt)&0Xff)));

"50
[e ( _eeprom_write (2
 , -> -> 0 `i `ui -> & _baseVolt -> -> 255 `i `ui `uc ]
[; ;calVol.c: 51: eeprom_write(0x01,((unsigned char)((baseVolt)>>8)));

"51
[e ( _eeprom_write (2
 , -> -> 1 `i `ui -> >> _baseVolt -> 8 `i `uc ]
"52
[; ;calVol.c: 52: }

[e :UE 7 ]
}
"59
[v _ChangeAmp `(v 1 ef ]
{
[; ;calVol.c: 58: void ChangeAmp(void)

[; ;calVol.c: 59: {

[e :U _ChangeAmp ]
[f ]
[; ;calVol.c: 60: if(Amp==1)

"60
[e $ ! == -> _Amp `i -> 1 `i 9  ]
[; ;calVol.c: 61: {

"61
{
[; ;calVol.c: 62: Amp=4;

"62
[e = _Amp -> -> 4 `i `uc ]
"63
}
[; ;calVol.c: 63: }

[e $U 10  ]
"64
[e :U 9 ]
[; ;calVol.c: 64: else if(Amp==4)

[e $ ! == -> _Amp `i -> 4 `i 11  ]
[; ;calVol.c: 65: {

"65
{
[; ;calVol.c: 66: Amp=1;

"66
[e = _Amp -> -> 1 `i `uc ]
"67
}
[e :U 11 ]
"68
[e :U 10 ]
[; ;calVol.c: 67: }

[; ;calVol.c: 68: eeprom_write(0x04+4+8+1,Amp);

[e ( _eeprom_write (2
 , -> + + + -> 4 `i -> 4 `i -> 8 `i -> 1 `i `ui _Amp ]
"69
[; ;calVol.c: 69: }

[e :UE 8 ]
}
"77
[v _ChangeBaseVolt `(v 1 ef1`uc ]
{
[; ;calVol.c: 76: void ChangeBaseVolt(unsigned char digit)

[; ;calVol.c: 77: {

[e :U _ChangeBaseVolt ]
[v _digit `uc 1 r1 ]
[f ]
[; ;calVol.c: 78: if(digit==0)

"78
[e $ ! == -> _digit `i -> 0 `i 13  ]
[; ;calVol.c: 79: {

"79
{
[; ;calVol.c: 80: baseVolt=baseVolt+100;

"80
[e = _baseVolt + _baseVolt -> -> 100 `i `ui ]
"81
}
[; ;calVol.c: 81: }

[e $U 14  ]
"82
[e :U 13 ]
[; ;calVol.c: 82: else if(digit==1)

[e $ ! == -> _digit `i -> 1 `i 15  ]
[; ;calVol.c: 83: {

"83
{
[; ;calVol.c: 84: baseVolt=baseVolt+10;

"84
[e = _baseVolt + _baseVolt -> -> 10 `i `ui ]
"85
}
[; ;calVol.c: 85: }

[e $U 16  ]
"86
[e :U 15 ]
[; ;calVol.c: 86: else if(digit==2)

[e $ ! == -> _digit `i -> 2 `i 17  ]
[; ;calVol.c: 87: {

"87
{
[; ;calVol.c: 88: baseVolt=baseVolt+1;

"88
[e = _baseVolt + _baseVolt -> -> 1 `i `ui ]
"89
}
[e :U 17 ]
"90
[e :U 16 ]
[e :U 14 ]
[; ;calVol.c: 89: }

[; ;calVol.c: 90: if(baseVolt>500)

[e $ ! > _baseVolt -> -> 500 `i `ui 18  ]
[; ;calVol.c: 91: {

"91
{
[; ;calVol.c: 92: baseVolt=400;

"92
[e = _baseVolt -> -> 400 `i `ui ]
"93
}
[e :U 18 ]
[; ;calVol.c: 93: }

[; ;calVol.c: 94: SaveBaseVolt(baseVolt);

"94
[e ( _SaveBaseVolt (1
 _baseVolt ]
"95
[; ;calVol.c: 95: }

[e :UE 12 ]
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -