|
|
View previous topic :: View next topic |
Author |
Message |
rudy
Joined: 27 Apr 2008 Posts: 167
|
PIC18F26K22 UNDER FLOW ERROR |
Posted: Tue Jan 18, 2022 6:18 am |
|
|
Hi guys! This is too much for me, I need help.
I am developing a new code for my clock, using the 18F26k22 and an 8 bits LCD routine. Everything was just fine, until I added the external RB0 ISR, that’s receives an 1Hz clock pulse from RTC. At this point, the program starts to show strange behaviors, and I start the MPLAB SIM to check what is going wrong.
All code works fine, but when I set PC to the EXTERNAL ISR, the debugger shows the following error:
CORE-E0002: Stack under flow error occurred from instruction at 0x0000ac
Really don’t have any idea of what is going wrong!
This is my list!
Code: |
--- C:\Program Files (x86)\PICC\devices\18F26K22.h ---------------------------------------------
1: //////////// Standard Header file for the PIC18F26K22 device ////////////////
2: ///////////////////////////////////////////////////////////////////////////
3: //// (C) Copyright 1996, 2014 Custom Computer Services ////
4: //// This source code may only be used by licensed users of the CCS C ////
5: //// compiler. This source code may only be distributed to other ////
6: //// licensed users of the CCS C compiler. No other use, reproduction ////
7: //// or distribution is permitted without written permission. ////
8: //// Derivative programs created using this software in object code ////
9: //// form are not restricted in any way. ////
10: ///////////////////////////////////////////////////////////////////////////
11: #device PIC18F26K22
0410 C044 MOVFF 0x44, 0x1
0414 C043 MOVFF 0x43, 0
0418 6643 TSTFSZ 0x43, ACCESS
041A 2A01 INCF 0x1, F, ACCESS
041C 0009 TBLRD*+
041E CFF5 MOVFF 0xff5, 0xfee
0422 2E00 DECFSZ 0, F, ACCESS
0424 D7FB BRA 0x41c
0426 2E01 DECFSZ 0x1, F, ACCESS
0428 D7F9 BRA 0x41c
042A 6AF8 CLRF 0xff8, ACCESS
042C EF8F GOTO 0x51e
--- C:\Users\m-a-c\Documents\CLOCK\SOFTWARE\PIC18F26K22\CLOCK_N.c ------------------------------
1: #include <18F26K22.h>
0000 EFEA GOTO 0x5d4
0008 6E04 MOVWF 0x4, ACCESS
000A CFD8 MOVFF 0xfd8, 0x5
000E CFE0 MOVFF 0xfe0, 0x6
0012 0100 MOVLB 0
0014 CFE9 MOVFF 0xfe9, 0xc
0018 CFEA MOVFF 0xfea, 0x7
001C CFE1 MOVFF 0xfe1, 0x8
0020 CFE2 MOVFF 0xfe2, 0x9
0024 CFD9 MOVFF 0xfd9, 0xa
0028 CFDA MOVFF 0xfda, 0xb
002C CFF3 MOVFF 0xff3, 0x12
0030 CFF4 MOVFF 0xff4, 0x13
0034 CFFA MOVFF 0xffa, 0x14
0038 CFF5 MOVFF 0xff5, 0x15
003C CFF6 MOVFF 0xff6, 0x16
0040 CFF7 MOVFF 0xff7, 0x17
0044 C000 MOVFF 0, 0xe
0048 C001 MOVFF 0x1, 0xf
004C C002 MOVFF 0x2, 0x10
0050 C003 MOVFF 0x3, 0x11
0054 A8F2 BTFSS 0xff2, 0x4, ACCESS
0056 EF30 GOTO 0x60
005A B2F2 BTFSC 0xff2, 0x1, ACCESS
005C EF57 GOTO 0xae
0060 C00E MOVFF 0xe, 0
0064 C00F MOVFF 0xf, 0x1
0068 C010 MOVFF 0x10, 0x2
006C C011 MOVFF 0x11, 0x3
0070 C00C MOVFF 0xc, 0xfe9
0074 C007 MOVFF 0x7, 0xfea
0078 8E07 BSF 0x7, 0x7, ACCESS
007A C008 MOVFF 0x8, 0xfe1
007E C009 MOVFF 0x9, 0xfe2
0082 C00A MOVFF 0xa, 0xfd9
0086 C00B MOVFF 0xb, 0xfda
008A C012 MOVFF 0x12, 0xff3
008E C013 MOVFF 0x13, 0xff4
0092 C014 MOVFF 0x14, 0xffa
0096 C015 MOVFF 0x15, 0xff5
009A C016 MOVFF 0x16, 0xff6
009E C017 MOVFF 0x17, 0xff7
00A2 5004 MOVF 0x4, W, ACCESS
00A4 C006 MOVFF 0x6, 0xfe0
00A8 C005 MOVFF 0x5, 0xfd8
00AC 0010 RETFIE 0
2: #fuses NOWDT, NOFCMEN, NOIESO, NOCPD, NOPROTECT, NOLVP, NODEBUG, PUT, BROWNOUT, NOMCLR
3: #use DELAY(INTERNAL=64MHz)
00D8 6AEA CLRF 0xfea, ACCESS
00DA 0E2E MOVLW 0x2e
00DC 6EE9 MOVWF 0xfe9, ACCESS
00DE 50EF MOVF 0xfef, W, ACCESS
00E0 E00E BZ 0xfe
00E2 0E14 MOVLW 0x14
00E4 6E01 MOVWF 0x1, ACCESS
00E6 6A00 CLRF 0, ACCESS
00E8 2E00 DECFSZ 0, F, ACCESS
00EA D7FE BRA 0xe8
00EC 2E01 DECFSZ 0x1, F, ACCESS
00EE D7FB BRA 0xe6
00F0 0EBF MOVLW 0xbf
00F2 6E00 MOVWF 0, ACCESS
00F4 2E00 DECFSZ 0, F, ACCESS
00F6 D7FE BRA 0xf4
00F8 D000 BRA 0xfa
00FA 2EEF DECFSZ 0xfef, F, ACCESS
00FC D7F2 BRA 0xe2
00FE 0012 RETURN 0
4:
5: #use FAST_IO(A)
6: //#use FAST_IO(B)
7: #use FAST_IO(C)
8: //#use FAST_IO(D)
9: #use FAST_IO(E)
10:
11: #byte PORTA=0xF80
12: #byte PORTB=0xF81
13: #byte PORTC=0xF82
14: //#byte PORTD=0xF83
15: #byte PORTE=0xF84
16:
17: #bit LCD_WR=PORTB.1 //LCR WRITE PIN
18: #bit LCD_RS=PORTB.2 //LCD REGISTER / COMMAND
19: #bit LCD_REST=PORTB.3 //LCD RESET PIN
20: #bit LCD_CS=PORTB.4 //LCD CHIP SELECT PIN
21:
22: //VARIÁVEIS DE SISTEMA
23: int PAGE=0, CCD, AUX0, AUX1, AUX2;
24: int FLAG0=0, FLAG1=0, FLAG2=0;
25: long COLLOR;
26:
27: //VARIÁVEIS DE RELÓGIO
28: int HORAS=0, MINUTOS=0, SEGUNDOS, DOW, DAY, MONTH, YEAR;
29: int HV1=0XFF, HV2=0XFF, MV1=0XFF, MV2=0XFF;
30:
31: #bit TIKTAK=FLAG0.0 //FLAG PARA DESENHAR PONTOS DO RELÓGIO
32: #bit CLK=FLAG0.1 //FLAG DE PONTOS DO RELÓGIO
33:
34: #bit LCK0=FLAG2.0 //LOCKS HLINE DRAWING CLOCK SCREEN
35:
36: //INCLUDES
37: #include<BITMAP.c>
38: #include<LCD_CMD.c>
39: #include<LCD_SCREENS.c>
40:
41: void main()
05D4 6AF8 CLRF 0xff8, ACCESS
05D6 9ED0 BCF 0xfd0, 0x7, ACCESS
05D8 8E07 BSF 0x7, 0x7, ACCESS
05DA 0E70 MOVLW 0x70
05DC 6ED3 MOVWF 0xfd3, ACCESS
05DE 8C9B BSF 0xf9b, 0x6, ACCESS
05E0 9E9B BCF 0xf9b, 0x7, ACCESS
05E2 6A19 CLRF 0x19, ACCESS
05E4 6A1E CLRF 0x1e, ACCESS
05E6 6A1F CLRF 0x1f, ACCESS
05E8 6A20 CLRF 0x20, ACCESS
05EA 6A23 CLRF 0x23, ACCESS
05EC 6A24 CLRF 0x24, ACCESS
05EE 682A SETF 0x2a, ACCESS
05F0 682B SETF 0x2b, ACCESS
05F2 682C SETF 0x2c, ACCESS
05F4 682D SETF 0x2d, ACCESS
05F6 010F MOVLB 0xf
05F8 6B38 CLRF 0x38, BANKED
05FA 6B39 CLRF 0x39, BANKED
05FC 6B3A CLRF 0x3a, BANKED
05FE 6B3B CLRF 0x3b, BANKED
0600 6B3C CLRF 0x3c, BANKED
0602 0101 MOVLB 0x1
0604 6B88 CLRF 0x88, BANKED
0606 6A77 CLRF 0xf77, ACCESS
0608 6A78 CLRF 0xf78, ACCESS
060A 6A79 CLRF 0xf79, ACCESS
42: {
43: PORT_B_PULLUPS(FALSE);
060C 6A61 CLRF 0xf61, ACCESS
44: SETUP_ADC_PORTS(NO_ANALOGS);
060E 50C1 MOVF 0xfc1, W, ACCESS
0610 0BF0 ANDLW 0xf0
0612 6EC1 MOVWF 0xfc1, ACCESS
0614 0E00 MOVLW 0
0616 010F MOVLB 0xf
0618 6F38 MOVWF 0x38, BANKED
061A 6F3C MOVWF 0x3c, BANKED
061C 6F39 MOVWF 0x39, BANKED
061E 6F3A MOVWF 0x3a, BANKED
0620 6F3B MOVWF 0x3b, BANKED
45: SETUP_COMPARATOR(NC_NC_NC_NC);
0622 6A77 CLRF 0xf77, ACCESS
0624 0E04 MOVLW 0x4
0626 6E78 MOVWF 0xf78, ACCESS
0628 6E79 MOVWF 0xf79, ACCESS
46: SETUP_COUNTERS(RTCC_INTERNAL,RTCC_DIV_1);
062A 90D1 BCF 0xfd1, 0, ACCESS
062C 0E88 MOVLW 0x88
062E 6ED5 MOVWF 0xfd5, ACCESS
47: SETUP_TIMER_1(T1_DISABLED|T1_DIV_BY_8);
0630 0E30 MOVLW 0x30
0632 6ECD MOVWF 0xfcd, ACCESS
0634 6ACC CLRF 0xfcc, ACCESS
48: SETUP_TIMER_2(T2_DISABLED,0XFF,16);
0636 0E78 MOVLW 0x78
0638 6EBA MOVWF 0xfba, ACCESS
063A 0EFF MOVLW 0xff
063C 6EBB MOVWF 0xfbb, ACCESS
49: SETUP_TIMER_3(T3_DISABLED);
063E 6AB4 CLRF 0xfb4, ACCESS
0640 6AB1 CLRF 0xfb1, ACCESS
50: SET_TRIS_A(0b11111111);
0642 6E92 MOVWF 0xf92, ACCESS
51: SET_TRIS_B(0b11100001);
0644 0EE1 MOVLW 0xe1
0646 6E93 MOVWF 0xf93, ACCESS
52: SET_TRIS_C(0b00000000);
0648 0E00 MOVLW 0
064A 6E94 MOVWF 0xf94, ACCESS
53: // SET_TRIS_D(0b11111111);
54: SET_TRIS_E(0b11111111);
064C 8096 BSF 0xf96, 0, ACCESS
064E 8296 BSF 0xf96, 0x1, ACCESS
0650 8496 BSF 0xf96, 0x2, ACCESS
0652 8696 BSF 0xf96, 0x3, ACCESS
55: EXT_INT_EDGE(L_TO_H);
0654 8CF1 BSF 0xff1, 0x6, ACCESS
56: ENABLE_INTERRUPTS(INT_EXT); //ENABLE RTC INTERRUPTS
0656 88F2 BSF 0xff2, 0x4, ACCESS
57: // ENABLE_INTERRUPTS(INT_CCP1); //INABLE INFRARED INTERRUPTION
58: ENABLE_INTERRUPTS(GLOBAL); //ENABLE GLOBAL INTERRUPTS
0658 0EC0 MOVLW 0xc0
065A 12F2 IORWF 0xff2, F, ACCESS
59:
60: LCD_INIT();
065C 0100 MOVLB 0
065E D55F BRA 0x11e
61: // START_SCN();
62: // DELAY_MS(5000);
63: CCD=7;
0660 0E07 MOVLW 0x7
0662 6E1A MOVWF 0x1a, ACCESS
64: LCD_FILL(0, 0, 480, 320); //CLEAR LCD
0664 6A2F CLRF 0x2f, ACCESS
0666 6A2E CLRF 0x2e, ACCESS
0668 6A31 CLRF 0x31, ACCESS
066A 6A30 CLRF 0x30, ACCESS
066C 0E01 MOVLW 0x1
066E 6E33 MOVWF 0x33, ACCESS
0670 0EE0 MOVLW 0xe0
0672 6E32 MOVWF 0x32, ACCESS
0674 0E01 MOVLW 0x1
0676 6E35 MOVWF 0x35, ACCESS
0678 0E40 MOVLW 0x40
067A 6E34 MOVWF 0x34, ACCESS
067C DE8D RCALL 0x398
65: loop:
66: while(1) //INICIALIZAÇÃO
67: {
68: if(CLK)CLOCK_SCN();
067E B21E BTFSC 0x1e, 0x1, ACCESS
0680 D780 BRA 0x582
0682 D7FD BRA 0x67e
69: }
70: goto loop;
0684 D7FC BRA 0x67e
71: }
72: #INT_EXT //RTC INTERRUPTION SERVICE ROUTINE
73: void RB0_ISR(void)
0686 0003 SLEEP
74: {
75: SEGUNDOS++;
00AE 2A25 INCF 0x25, F, ACCESS
76: if(SEGUNDOS==60)
00B0 5025 MOVF 0x25, W, ACCESS
00B2 083C SUBLW 0x3c
00B4 E104 BNZ 0xbe
77: {
78: SEGUNDOS=0;
00B6 6A25 CLRF 0x25, ACCESS
79: MINUTOS++;
00B8 2A24 INCF 0x24, F, ACCESS
80: LCK0=0;
00BA 9020 BCF 0x20, 0, ACCESS
81: TIKTAK=0; //sincroniza pontos do relógio
00BC 901E BCF 0x1e, 0, ACCESS
82: }
83: if(MINUTOS==60)
00BE 5024 MOVF 0x24, W, ACCESS
00C0 083C SUBLW 0x3c
00C2 E102 BNZ 0xc8
84: {
85: MINUTOS=0;
00C4 6A24 CLRF 0x24, ACCESS
86: HORAS++;
00C6 2A23 INCF 0x23, F, ACCESS
87: }
88: if(HORAS==24)HORAS=0;
00C8 5023 MOVF 0x23, W, ACCESS
00CA 0818 SUBLW 0x18
00CC E101 BNZ 0xd0
00CE 6A23 CLRF 0x23, ACCESS
89: // if(!HORAS&&!MINUTOS&&SEGUNDOS==5)RTC_GDT=1; //GET NEW DATE WHEN CLOCK IS SHOWED
90: CLK=1;
00D0 821E BSF 0x1e, 0x1, ACCESS
00D2 92F2 BCF 0xff2, 0x1, ACCESS
00D4 EF30 GOTO 0x60
--- C:\Users\m-a-c\Documents\CLOCK\SOFTWARE\PIC18F46K22\LCD_CMD.c ------------------------------
1: void COLLOR_SELECT() //SET LCD COLLOR
2: {
3: if(CCD==1)COLLOR=0XFFFF; //WHITE
02CE 2C1A DECFSZ 0x1a, W, ACCESS
02D0 D002 BRA 0x2d6
02D2 6822 SETF 0x22, ACCESS
02D4 6821 SETF 0x21, ACCESS
4: if(CCD==2)COLLOR=0X001F; //BLUE
02D6 501A MOVF 0x1a, W, ACCESS
02D8 0802 SUBLW 0x2
02DA E103 BNZ 0x2e2
02DC 6A22 CLRF 0x22, ACCESS
02DE 0E1F MOVLW 0x1f
02E0 6E21 MOVWF 0x21, ACCESS
5: if(CCD==3)COLLOR=0XF800; //RED
02E2 501A MOVF 0x1a, W, ACCESS
02E4 0803 SUBLW 0x3
02E6 E103 BNZ 0x2ee
02E8 0EF8 MOVLW 0xf8
02EA 6E22 MOVWF 0x22, ACCESS
02EC 6A21 CLRF 0x21, ACCESS
6: if(CCD==4)COLLOR=0XFFE0; //YELLOW
02EE 501A MOVF 0x1a, W, ACCESS
02F0 0804 SUBLW 0x4
02F2 E103 BNZ 0x2fa
02F4 6822 SETF 0x22, ACCESS
02F6 0EE0 MOVLW 0xe0
02F8 6E21 MOVWF 0x21, ACCESS
7: if(CCD==5)COLLOR=0X07E0; //GREEN
02FA 501A MOVF 0x1a, W, ACCESS
02FC 0805 SUBLW 0x5
02FE E104 BNZ 0x308
0300 0E07 MOVLW 0x7
0302 6E22 MOVWF 0x22, ACCESS
0304 0EE0 MOVLW 0xe0
0306 6E21 MOVWF 0x21, ACCESS
8: if(CCD==6)COLLOR=0X07FF; //CYAN
0308 501A MOVF 0x1a, W, ACCESS
030A 0806 SUBLW 0x6
030C E103 BNZ 0x314
030E 0E07 MOVLW 0x7
0310 6E22 MOVWF 0x22, ACCESS
0312 6821 SETF 0x21, ACCESS
9: if(CCD==7)COLLOR=0X0000; //BLACK
0314 501A MOVF 0x1a, W, ACCESS
0316 0807 SUBLW 0x7
0318 E102 BNZ 0x31e
031A 6A22 CLRF 0x22, ACCESS
031C 6A21 CLRF 0x21, ACCESS
10: if(CCD==8)COLLOR=0XF81F; //MAGENTA
031E 501A MOVF 0x1a, W, ACCESS
0320 0808 SUBLW 0x8
0322 E104 BNZ 0x32c
0324 0EF8 MOVLW 0xf8
0326 6E22 MOVWF 0x22, ACCESS
0328 0E1F MOVLW 0x1f
032A 6E21 MOVWF 0x21, ACCESS
11: if(CCD==9)COLLOR=0x7BEF; //DARKGREY
032C 501A MOVF 0x1a, W, ACCESS
032E 0809 SUBLW 0x9
0330 E104 BNZ 0x33a
0332 0E7B MOVLW 0x7b
0334 6E22 MOVWF 0x22, ACCESS
0336 0EEF MOVLW 0xef
0338 6E21 MOVWF 0x21, ACCESS
033A 0012 RETURN 0
12: //NAVY=0x000F
13: //DARKGREEN=0x03E0
14: //DARKCYAN=0x03EF
15: //MAROON=0x7800
16: //PURPLE=0x780F
17: //OLIVE=0x7BE0
18: //LIGHTGREY=0xC618
19: //DARKGREY=0x7BEF
20: //BLUE=0x001F
21: //GREEN=0x07E0
22: //CYAN=0x07FF
23: //RED=0xF800
24: //MAGENTA=0xF81F
25: //YELLOW=0xFFE0
26: //WHITE=0xFFFF
27: //ORANGE=0xFD20
28: //GREENYELLOW=0xAFE5
29: //PINK=0xFC18
30: }
31: void LCD_BUS(int C)
32: {
33: PORTC=C;
0100 C053 MOVFF 0x53, 0xf82
34: LCD_WR=0;
0104 9281 BCF 0xf81, 0x1, ACCESS
35: LCD_WR=1;
0106 8281 BSF 0xf81, 0x1, ACCESS
0108 0012 RETURN 0
36: }
37: void LCD_COM(int VH)
38: {
39: LCD_RS=0;
010A 9481 BCF 0xf81, 0x2, ACCESS
40: LCD_BUS(VH);
010C C050 MOVFF 0x50, 0x53
0110 DFF7 RCALL 0x100
0112 0012 RETURN 0
41: }
42: void LCD_DATA(int VH)
43: {
44: LCD_RS=1;
0114 8481 BSF 0xf81, 0x2, ACCESS
45: LCD_BUS(VH);
0116 C052 MOVFF 0x52, 0x53
011A DFF2 RCALL 0x100
011C 0012 RETURN 0
46: }
47: void LCD_ADD(long x1, long y1, long x2, long y2)
48: {
49: LCD_COM(0X2A);
033C 0E2A MOVLW 0x2a
033E 6E50 MOVWF 0x50, ACCESS
0340 DEE4 RCALL 0x10a
50: LCD_DATA(x1>>8);
0342 C049 MOVFF 0x49, 0x50
0346 6A51 CLRF 0x51, ACCESS
0348 C049 MOVFF 0x49, 0x52
034C DEE3 RCALL 0x114
51: LCD_DATA(x1);
034E C048 MOVFF 0x48, 0x52
0352 DEE0 RCALL 0x114
52: LCD_DATA(x2>>8);
0354 C04D MOVFF 0x4d, 0x50
0358 6A51 CLRF 0x51, ACCESS
035A C04D MOVFF 0x4d, 0x52
035E DEDA RCALL 0x114
53: LCD_DATA(x2);
0360 C04C MOVFF 0x4c, 0x52
0364 DED7 RCALL 0x114
54: LCD_COM(0X2B);
0366 0E2B MOVLW 0x2b
0368 6E50 MOVWF 0x50, ACCESS
036A DECF RCALL 0x10a
55: LCD_DATA(y1>>8);
036C C04B MOVFF 0x4b, 0x50
0370 6A51 CLRF 0x51, ACCESS
0372 C04B MOVFF 0x4b, 0x52
0376 DECE RCALL 0x114
56: LCD_DATA(y1);
0378 C04A MOVFF 0x4a, 0x52
037C DECB RCALL 0x114
57: LCD_DATA(y2>>8);
037E C04F MOVFF 0x4f, 0x50
0382 6A51 CLRF 0x51, ACCESS
0384 C04F MOVFF 0x4f, 0x52
0388 DEC5 RCALL 0x114
58: LCD_DATA(y2);
038A C04E MOVFF 0x4e, 0x52
038E DEC2 RCALL 0x114
59: LCD_COM(0X2C);
0390 0E2C MOVLW 0x2c
0392 6E50 MOVWF 0x50, ACCESS
0394 DEBA RCALL 0x10a
0396 0012 RETURN 0
60: }
61: void LCD_HLINE(long x, long y, long l)
62: {
63: long i, j;
64: COLLOR_SELECT();
65: LCD_COM(0X2C); //write_memory_start
66: LCD_RS=1;
67: LCD_CS=0;
68: l=l+x;
69: LCD_ADD(x, y, l, y);
70: j=l*2;
71: for(i=1; i<=j; i++)
72: {
73: LCD_DATA(COLLOR>>8);
74: LCD_DATA(COLLOR);
75: }
76: LCD_CS=1;
77: }
78: void LCD_VLINE(long x, long y, long l)
79: {
80: long i, j;
81: COLLOR_SELECT();
82: LCD_COM(0X2C); //write_memory_start
83: LCD_RS=1;
84: LCD_CS=0;
85: l=l+y;
86: LCD_ADD(x, y, x, l);
87: j=l*2;
88: for(i=1; i<=j; i++)
89: {
90: LCD_DATA(COLLOR>>8);
91: LCD_DATA(COLLOR);
92: }
93: LCD_CS=1;
94: }
95: void LCD_FILL(long x, long y, long x1, long y1)
96: {
97: long i, m;
98: COLLOR_SELECT();
0398 DF9A RCALL 0x2ce
99: LCD_COM(0X2C); //write_memory_start
039A 0E2C MOVLW 0x2c
039C 6E50 MOVWF 0x50, ACCESS
039E DEB5 RCALL 0x10a
100: LCD_RS=1;
03A0 8481 BSF 0xf81, 0x2, ACCESS
101: LCD_CS=0;
03A2 9881 BCF 0xf81, 0x4, ACCESS
102: LCD_ADD(x, y, x1, y1);
03A4 C02F MOVFF 0x2f, 0x49
03A8 C02E MOVFF 0x2e, 0x48
03AC C031 MOVFF 0x31, 0x4b
03B0 C030 MOVFF 0x30, 0x4a
03B4 C033 MOVFF 0x33, 0x4d
03B8 C032 MOVFF 0x32, 0x4c
03BC C035 MOVFF 0x35, 0x4f
03C0 C034 MOVFF 0x34, 0x4e
03C4 DFBB RCALL 0x33c
103: for(i=0; i<x1; i++)
03C6 6A37 CLRF 0x37, ACCESS
03C8 6A36 CLRF 0x36, ACCESS
03CA 5037 MOVF 0x37, W, ACCESS
03CC 5C33 SUBWF 0x33, W, ACCESS
03CE E31E BNC 0x40c
03D0 E103 BNZ 0x3d8
03D2 5032 MOVF 0x32, W, ACCESS
03D4 5C36 SUBWF 0x36, W, ACCESS
03D6 E21A BC 0x40c
104: {
105: for(m=0; m<y1; m++)
03D8 6A39 CLRF 0x39, ACCESS
03DA 6A38 CLRF 0x38, ACCESS
03DC 5039 MOVF 0x39, W, ACCESS
03DE 5C35 SUBWF 0x35, W, ACCESS
03E0 E311 BNC 0x404
03E2 E103 BNZ 0x3ea
03E4 5034 MOVF 0x34, W, ACCESS
03E6 5C38 SUBWF 0x38, W, ACCESS
03E8 E20D BC 0x404
106: {
107: LCD_DATA(COLLOR>>8);
03EA C022 MOVFF 0x22, 0x3a
03EE 6A3B CLRF 0x3b, ACCESS
03F0 C022 MOVFF 0x22, 0x52
03F4 DE8F RCALL 0x114
108: LCD_DATA(COLLOR);
03F6 C021 MOVFF 0x21, 0x52
03FA DE8C RCALL 0x114
03FC 2A38 INCF 0x38, F, ACCESS
03FE B4D8 BTFSC 0xfd8, 0x2, ACCESS
0400 2A39 INCF 0x39, F, ACCESS
0402 D7EC BRA 0x3dc
109: }
0404 2A36 INCF 0x36, F, ACCESS
0406 B4D8 BTFSC 0xfd8, 0x2, ACCESS
0408 2A37 INCF 0x37, F, ACCESS
040A D7DF BRA 0x3ca
110: }
111: LCD_CS=1;
040C 8881 BSF 0xf81, 0x4, ACCESS
040E 0012 RETURN 0
112: }
113: void LCD_PX(long x, long y)
114: {
115: LCD_COM(0X2C); //write_memory_start
0430 0E2C MOVLW 0x2c
0432 6E50 MOVWF 0x50, ACCESS
0434 DE6A RCALL 0x10a
116: LCD_RS=1;
0436 8481 BSF 0xf81, 0x2, ACCESS
117: LCD_CS=0;
0438 9881 BCF 0xf81, 0x4, ACCESS
118: LCD_ADD(x, y, x, y);
043A C045 MOVFF 0x45, 0x49
043E C044 MOVFF 0x44, 0x48
0442 C047 MOVFF 0x47, 0x4b
0446 C046 MOVFF 0x46, 0x4a
044A C045 MOVFF 0x45, 0x4d
044E C044 MOVFF 0x44, 0x4c
0452 C047 MOVFF 0x47, 0x4f
0456 C046 MOVFF 0x46, 0x4e
045A DF70 RCALL 0x33c
119: LCD_COM(0x2A); // Column address set
045C 0E2A MOVLW 0x2a
045E 6E50 MOVWF 0x50, ACCESS
0460 DE54 RCALL 0x10a
120: LCD_DATA(x>>8);
0462 C045 MOVFF 0x45, 0x48
0466 6A49 CLRF 0x49, ACCESS
0468 C045 MOVFF 0x45, 0x52
046C DE53 RCALL 0x114
121: LCD_DATA(x);
046E C044 MOVFF 0x44, 0x52
0472 DE50 RCALL 0x114
122: LCD_COM(0X2B); // Row address set
0474 0E2B MOVLW 0x2b
0476 6E50 MOVWF 0x50, ACCESS
0478 DE48 RCALL 0x10a
123: LCD_DATA(y>>8);
047A C047 MOVFF 0x47, 0x48
047E 6A49 CLRF 0x49, ACCESS
0480 C047 MOVFF 0x47, 0x52
0484 DE47 RCALL 0x114
124: LCD_DATA(y);
0486 C046 MOVFF 0x46, 0x52
048A DE44 RCALL 0x114
125: LCD_COM(0X2C); // Write to RAM
048C 0E2C MOVLW 0x2c
048E 6E50 MOVWF 0x50, ACCESS
0490 DE3C RCALL 0x10a
126: LCD_DATA(COLLOR>>8);
0492 C022 MOVFF 0x22, 0x48
0496 6A49 CLRF 0x49, ACCESS
0498 C022 MOVFF 0x22, 0x52
049C DE3B RCALL 0x114
127: LCD_DATA(COLLOR);
049E C021 MOVFF 0x21, 0x52
04A2 DE38 RCALL 0x114
128: LCD_CS=1;
04A4 8881 BSF 0xf81, 0x4, ACCESS
04A6 EFB3 GOTO 0x566
129: }
130: void LCD_DRAW(rom int *btm, long x, long y, long w, long h)
131: {
132: int i, k, _byte, _w;
133: long _x, _y, _z;
134: COLLOR_SELECT();
04AA DF11 RCALL 0x2ce
135: _z=0;
04AC 6A41 CLRF 0x41, ACCESS
04AE 6A40 CLRF 0x40, ACCESS
136: for(_y=0; _y<h; _y++)
04B0 6A3F CLRF 0x3f, ACCESS
04B2 6A3E CLRF 0x3e, ACCESS
04B4 503F MOVF 0x3f, W, ACCESS
04B6 5C37 SUBWF 0x37, W, ACCESS
04B8 E362 BNC 0x57e
04BA E103 BNZ 0x4c2
04BC 5036 MOVF 0x36, W, ACCESS
04BE 5C3E SUBWF 0x3e, W, ACCESS
04C0 E25E BC 0x57e
137: {
138: _x=x;
04C2 C031 MOVFF 0x31, 0x3d
04C6 C030 MOVFF 0x30, 0x3c
139: for(_w=0; _w<(w+7)/8; _w++)
04CA 6A3B CLRF 0x3b, ACCESS
04CC 0E07 MOVLW 0x7
04CE 2434 ADDWF 0x34, W, ACCESS
04D0 6E42 MOVWF 0x42, ACCESS
04D2 0E00 MOVLW 0
04D4 2035 ADDWFC 0x35, W, ACCESS
04D6 6E43 MOVWF 0x43, ACCESS
04D8 3043 RRCF 0x43, W, ACCESS
04DA 6E03 MOVWF 0x3, ACCESS
04DC 3042 RRCF 0x42, W, ACCESS
04DE 6E02 MOVWF 0x2, ACCESS
04E0 3203 RRCF 0x3, F, ACCESS
04E2 3202 RRCF 0x2, F, ACCESS
04E4 3203 RRCF 0x3, F, ACCESS
04E6 3202 RRCF 0x2, F, ACCESS
04E8 0E1F MOVLW 0x1f
04EA 1603 ANDWF 0x3, F, ACCESS
04EC C002 MOVFF 0x2, 0x1
04F0 5203 MOVF 0x3, F, ACCESS
04F2 E103 BNZ 0x4fa
04F4 5001 MOVF 0x1, W, ACCESS
04F6 5C3B SUBWF 0x3b, W, ACCESS
04F8 E23E BC 0x576
140: {
141: _byte=btm[_z];
04FA 5040 MOVF 0x40, W, ACCESS
04FC 242E ADDWF 0x2e, W, ACCESS
04FE 6E01 MOVWF 0x1, ACCESS
0500 5041 MOVF 0x41, W, ACCESS
0502 202F ADDWFC 0x2f, W, ACCESS
0504 6E03 MOVWF 0x3, ACCESS
0506 5001 MOVF 0x1, W, ACCESS
0508 6EF6 MOVWF 0xff6, ACCESS
050A C003 MOVFF 0x3, 0xff7
050E 6AF8 CLRF 0xff8, ACCESS
0510 6AEA CLRF 0xfea, ACCESS
0512 0E42 MOVLW 0x42
0514 6EE9 MOVWF 0xfe9, ACCESS
0516 6A44 CLRF 0x44, ACCESS
0518 0E01 MOVLW 0x1
051A 6E43 MOVWF 0x43, ACCESS
051C D779 BRA 0x410
051E C042 MOVFF 0x42, 0x3a
142: _z++;
0522 2A40 INCF 0x40, F, ACCESS
0524 B4D8 BTFSC 0xfd8, 0x2, ACCESS
0526 2A41 INCF 0x41, F, ACCESS
143: k=7;
0528 0E07 MOVLW 0x7
052A 6E39 MOVWF 0x39, ACCESS
144: for(i=0; i<8; i++)
052C 6A38 CLRF 0x38, ACCESS
052E 5038 MOVF 0x38, W, ACCESS
0530 0807 SUBLW 0x7
0532 E31F BNC 0x572
145: {
146: if(bit_test(_byte,k))
0534 C03A MOVFF 0x3a, 0
0538 5039 MOVF 0x39, W, ACCESS
053A 6E01 MOVWF 0x1, ACCESS
053C E004 BZ 0x546
053E 90D8 BCF 0xfd8, 0, ACCESS
0540 3200 RRCF 0, F, ACCESS
0542 2E01 DECFSZ 0x1, F, ACCESS
0544 D7FC BRA 0x53e
0546 A000 BTFSS 0, 0, ACCESS
0548 D00E BRA 0x566
147: {
148: LCD_PX(_x, y+_y);
054A 503E MOVF 0x3e, W, ACCESS
054C 2432 ADDWF 0x32, W, ACCESS
054E 6E42 MOVWF 0x42, ACCESS
0550 503F MOVF 0x3f, W, ACCESS
0552 2033 ADDWFC 0x33, W, ACCESS
0554 6E43 MOVWF 0x43, ACCESS
0556 C03D MOVFF 0x3d, 0x45
055A C03C MOVFF 0x3c, 0x44
055E 6E47 MOVWF 0x47, ACCESS
0560 C042 MOVFF 0x42, 0x46
0564 D765 BRA 0x430
149: }
150: k--;
0566 0639 DECF 0x39, F, ACCESS
151: _x++;
0568 2A3C INCF 0x3c, F, ACCESS
056A B4D8 BTFSC 0xfd8, 0x2, ACCESS
056C 2A3D INCF 0x3d, F, ACCESS
056E 2A38 INCF 0x38, F, ACCESS
0570 D7DE BRA 0x52e
152: }
0572 2A3B INCF 0x3b, F, ACCESS
0574 D7AB BRA 0x4cc
153: }
0576 2A3E INCF 0x3e, F, ACCESS
0578 B4D8 BTFSC 0xfd8, 0x2, ACCESS
057A 2A3F INCF 0x3f, F, ACCESS
057C D79B BRA 0x4b4
154: }
057E EFD6 GOTO 0x5ac
155: }
156: void LCD_PLT(int SWT, long x, long Y)
157: {
158: switch(SWT)
159: {
160: //BIG FONT - 0 a 9
161: case 0: //ZERO BIG FONT
162: LCD_DRAW(ZERO, x, y, 69, 120);
163: break;
164: case 1: //UM BIG FONT
165: LCD_DRAW(UM, x, y, 69, 120);
166: break;
167: case 2: //DOIS BIG FONT
168: LCD_DRAW(DOIS, x, y, 69, 120);
169: break;
170: case 3: //TRES BIG FONT
171: LCD_DRAW(TRES, x, y, 69, 120);
172: break;
173: case 4: //QUATRO BIG FONT
174: LCD_DRAW(QUATRO, x, y, 69, 120);
175: break;
176: case 5: //CINCO BIG FONT
177: LCD_DRAW(CINCO, x, y, 69, 120);
178: break;
179: case 6: //SEIS BIG FONT
180: LCD_DRAW(SEIS, x, y, 69, 120);
181: break;
182: case 7: //SETE BIG FONT
183: LCD_DRAW(SETE, x, y, 69, 120);
184: break;
185: case 8: //SETE BIG FONT
186: LCD_DRAW(OITO, x, y, 69, 120);
187: break;
188: case 9: //SETE BIG FONT
189: LCD_DRAW(NOVE, x, y, 69, 120);
190: break;
191: //SMALL FONT 1
192: }
193: }
194: void LCD_INIT()
195: {
196: LCD_REST=1;
011E 8681 BSF 0xf81, 0x3, ACCESS
197: delay_ms(5);
0120 0E05 MOVLW 0x5
0122 6E2E MOVWF 0x2e, ACCESS
0124 DFD9 RCALL 0xd8
198: LCD_REST=0;
0126 9681 BCF 0xf81, 0x3, ACCESS
199: delay_ms(15);
0128 0E0F MOVLW 0xf
012A 6E2E MOVWF 0x2e, ACCESS
012C DFD5 RCALL 0xd8
200: LCD_REST=1;
012E 8681 BSF 0xf81, 0x3, ACCESS
201: delay_ms(15);
0130 0E0F MOVLW 0xf
0132 6E2E MOVWF 0x2e, ACCESS
0134 DFD1 RCALL 0xd8
202: LCD_CS=1;
0136 8881 BSF 0xf81, 0x4, ACCESS
203: LCD_WR=1;
0138 8281 BSF 0xf81, 0x1, ACCESS
204: LCD_CS=0;
013A 9881 BCF 0xf81, 0x4, ACCESS
205:
206: LCD_COM(0XF7);
013C 0EF7 MOVLW 0xf7
013E 6E50 MOVWF 0x50, ACCESS
0140 DFE4 RCALL 0x10a
207: LCD_DATA(0XA9);
0142 0EA9 MOVLW 0xa9
0144 6E52 MOVWF 0x52, ACCESS
0146 DFE6 RCALL 0x114
208: LCD_DATA(0X51);
0148 0E51 MOVLW 0x51
014A 6E52 MOVWF 0x52, ACCESS
014C DFE3 RCALL 0x114
209: LCD_DATA(0X2C);
014E 0E2C MOVLW 0x2c
0150 6E52 MOVWF 0x52, ACCESS
0152 DFE0 RCALL 0x114
210: LCD_DATA(0X82);
0154 0E82 MOVLW 0x82
0156 6E52 MOVWF 0x52, ACCESS
0158 DFDD RCALL 0x114
211:
212: LCD_COM(0XC0);
015A 0EC0 MOVLW 0xc0
015C 6E50 MOVWF 0x50, ACCESS
015E DFD5 RCALL 0x10a
213: LCD_DATA(0X11);
0160 0E11 MOVLW 0x11
0162 6E52 MOVWF 0x52, ACCESS
0164 DFD7 RCALL 0x114
214: LCD_DATA(0X09);
0166 0E09 MOVLW 0x9
0168 6E52 MOVWF 0x52, ACCESS
016A DFD4 RCALL 0x114
215: LCD_COM(0XC1);
016C 0EC1 MOVLW 0xc1
016E 6E50 MOVWF 0x50, ACCESS
0170 DFCC RCALL 0x10a
216: LCD_DATA(0X41);
0172 0E41 MOVLW 0x41
0174 6E52 MOVWF 0x52, ACCESS
0176 DFCE RCALL 0x114
217: LCD_COM(0XC5);
0178 0EC5 MOVLW 0xc5
017A 6E50 MOVWF 0x50, ACCESS
017C DFC6 RCALL 0x10a
218: LCD_DATA(0X00);
017E 6A52 CLRF 0x52, ACCESS
0180 DFC9 RCALL 0x114
219: LCD_DATA(0X0A);
0182 0E0A MOVLW 0xa
0184 6E52 MOVWF 0x52, ACCESS
0186 DFC6 RCALL 0x114
220: LCD_DATA(0X80);
0188 0E80 MOVLW 0x80
018A 6E52 MOVWF 0x52, ACCESS
018C DFC3 RCALL 0x114
221: LCD_COM(0XB1);
018E 0EB1 MOVLW 0xb1
0190 6E50 MOVWF 0x50, ACCESS
0192 DFBB RCALL 0x10a
222: LCD_DATA(0XA0);
0194 0EA0 MOVLW 0xa0
0196 6E52 MOVWF 0x52, ACCESS
0198 DFBD RCALL 0x114
223: LCD_DATA(0X11);
019A 0E11 MOVLW 0x11
019C 6E52 MOVWF 0x52, ACCESS
019E DFBA RCALL 0x114
224: LCD_COM(0XB4);
01A0 0EB4 MOVLW 0xb4
01A2 6E50 MOVWF 0x50, ACCESS
01A4 DFB2 RCALL 0x10a
225: LCD_DATA(0X02);
01A6 0E02 MOVLW 0x2
01A8 6E52 MOVWF 0x52, ACCESS
01AA DFB4 RCALL 0x114
226: LCD_COM(0XB6);
01AC 0EB6 MOVLW 0xb6
01AE 6E50 MOVWF 0x50, ACCESS
01B0 DFAC RCALL 0x10a
227: LCD_DATA(0X02);
01B2 0E02 MOVLW 0x2
01B4 6E52 MOVWF 0x52, ACCESS
01B6 DFAE RCALL 0x114
228: LCD_DATA(0X22);
01B8 0E22 MOVLW 0x22
01BA 6E52 MOVWF 0x52, ACCESS
01BC DFAB RCALL 0x114
229: LCD_COM(0XB7);
01BE 0EB7 MOVLW 0xb7
01C0 6E50 MOVWF 0x50, ACCESS
01C2 DFA3 RCALL 0x10a
230: LCD_DATA(0Xc6);
01C4 0EC6 MOVLW 0xc6
01C6 6E52 MOVWF 0x52, ACCESS
01C8 DFA5 RCALL 0x114
231: LCD_COM(0XBE);
01CA 0EBE MOVLW 0xbe
01CC 6E50 MOVWF 0x50, ACCESS
01CE DF9D RCALL 0x10a
232: LCD_DATA(0X00);
01D0 6A52 CLRF 0x52, ACCESS
01D2 DFA0 RCALL 0x114
233: LCD_DATA(0X04);
01D4 0E04 MOVLW 0x4
01D6 6E52 MOVWF 0x52, ACCESS
01D8 DF9D RCALL 0x114
234: LCD_COM(0XE9);
01DA 0EE9 MOVLW 0xe9
01DC 6E50 MOVWF 0x50, ACCESS
01DE DF95 RCALL 0x10a
235: LCD_DATA(0X00);
01E0 6A52 CLRF 0x52, ACCESS
01E2 DF98 RCALL 0x114
236: LCD_COM(0X36);
01E4 0E36 MOVLW 0x36
01E6 6E50 MOVWF 0x50, ACCESS
01E8 DF90 RCALL 0x10a
237: LCD_DATA(0XB8); //HORIZONTAL
01EA 0EB8 MOVLW 0xb8
01EC 6E52 MOVWF 0x52, ACCESS
01EE DF92 RCALL 0x114
238: // LCD_DATA(0X08); //VERTICAL
239:
240: //SET DBI
241: LCD_COM(0X3A);
01F0 0E3A MOVLW 0x3a
01F2 6E50 MOVWF 0x50, ACCESS
01F4 DF8A RCALL 0x10a
242: LCD_DATA(0X55);
01F6 0E55 MOVLW 0x55
01F8 6E52 MOVWF 0x52, ACCESS
01FA DF8C RCALL 0x114
243:
244: LCD_COM(0XE0);
01FC 0EE0 MOVLW 0xe0
01FE 6E50 MOVWF 0x50, ACCESS
0200 DF84 RCALL 0x10a
245: LCD_DATA(0X00);
0202 6A52 CLRF 0x52, ACCESS
0204 DF87 RCALL 0x114
246: LCD_DATA(0X07);
0206 0E07 MOVLW 0x7
0208 6E52 MOVWF 0x52, ACCESS
020A DF84 RCALL 0x114
247: LCD_DATA(0X10);
020C 0E10 MOVLW 0x10
020E 6E52 MOVWF 0x52, ACCESS
0210 DF81 RCALL 0x114
248: LCD_DATA(0X09);
0212 0E09 MOVLW 0x9
0214 6E52 MOVWF 0x52, ACCESS
0216 DF7E RCALL 0x114
249: LCD_DATA(0X17);
0218 0E17 MOVLW 0x17
021A 6E52 MOVWF 0x52, ACCESS
021C DF7B RCALL 0x114
250: LCD_DATA(0X0B);
021E 0E0B MOVLW 0xb
0220 6E52 MOVWF 0x52, ACCESS
0222 DF78 RCALL 0x114
251: LCD_DATA(0X41);
0224 0E41 MOVLW 0x41
0226 6E52 MOVWF 0x52, ACCESS
0228 DF75 RCALL 0x114
252: LCD_DATA(0X89);
022A 0E89 MOVLW 0x89
022C 6E52 MOVWF 0x52, ACCESS
022E DF72 RCALL 0x114
253: LCD_DATA(0X4B);
0230 0E4B MOVLW 0x4b
0232 6E52 MOVWF 0x52, ACCESS
0234 DF6F RCALL 0x114
254: LCD_DATA(0X0A);
0236 0E0A MOVLW 0xa
0238 6E52 MOVWF 0x52, ACCESS
023A DF6C RCALL 0x114
255: LCD_DATA(0X0C);
023C 0E0C MOVLW 0xc
023E 6E52 MOVWF 0x52, ACCESS
0240 DF69 RCALL 0x114
256: LCD_DATA(0X0E);
0242 0E0E MOVLW 0xe
0244 6E52 MOVWF 0x52, ACCESS
0246 DF66 RCALL 0x114
257: LCD_DATA(0X18);
0248 0E18 MOVLW 0x18
024A 6E52 MOVWF 0x52, ACCESS
024C DF63 RCALL 0x114
258: LCD_DATA(0X1B);
024E 0E1B MOVLW 0x1b
0250 6E52 MOVWF 0x52, ACCESS
0252 DF60 RCALL 0x114
259: LCD_DATA(0X0F);
0254 0E0F MOVLW 0xf
0256 6E52 MOVWF 0x52, ACCESS
0258 DF5D RCALL 0x114
260: LCD_COM(0XE1);
025A 0EE1 MOVLW 0xe1
025C 6E50 MOVWF 0x50, ACCESS
025E DF55 RCALL 0x10a
261: LCD_DATA(0X00);
0260 6A52 CLRF 0x52, ACCESS
0262 DF58 RCALL 0x114
262: LCD_DATA(0X17);
0264 0E17 MOVLW 0x17
0266 6E52 MOVWF 0x52, ACCESS
0268 DF55 RCALL 0x114
263: LCD_DATA(0X1A);
026A 0E1A MOVLW 0x1a
026C 6E52 MOVWF 0x52, ACCESS
026E DF52 RCALL 0x114
264: LCD_DATA(0X04);
0270 0E04 MOVLW 0x4
0272 6E52 MOVWF 0x52, ACCESS
0274 DF4F RCALL 0x114
265: LCD_DATA(0X0E);
0276 0E0E MOVLW 0xe
0278 6E52 MOVWF 0x52, ACCESS
027A DF4C RCALL 0x114
266: LCD_DATA(0X06);
027C 0E06 MOVLW 0x6
027E 6E52 MOVWF 0x52, ACCESS
0280 DF49 RCALL 0x114
267: LCD_DATA(0X2F);
0282 0E2F MOVLW 0x2f
0284 6E52 MOVWF 0x52, ACCESS
0286 DF46 RCALL 0x114
268: LCD_DATA(0X45);
0288 0E45 MOVLW 0x45
028A 6E52 MOVWF 0x52, ACCESS
028C DF43 RCALL 0x114
269: LCD_DATA(0X43);
028E 0E43 MOVLW 0x43
0290 6E52 MOVWF 0x52, ACCESS
0292 DF40 RCALL 0x114
270: LCD_DATA(0X02);
0294 0E02 MOVLW 0x2
0296 6E52 MOVWF 0x52, ACCESS
0298 DF3D RCALL 0x114
271: LCD_DATA(0X0A);
029A 0E0A MOVLW 0xa
029C 6E52 MOVWF 0x52, ACCESS
029E DF3A RCALL 0x114
272: LCD_DATA(0X09);
02A0 0E09 MOVLW 0x9
02A2 6E52 MOVWF 0x52, ACCESS
02A4 DF37 RCALL 0x114
273: LCD_DATA(0X32);
02A6 0E32 MOVLW 0x32
02A8 6E52 MOVWF 0x52, ACCESS
02AA DF34 RCALL 0x114
274: LCD_DATA(0X36);
02AC 0E36 MOVLW 0x36
02AE 6E52 MOVWF 0x52, ACCESS
02B0 DF31 RCALL 0x114
275: LCD_DATA(0X0F);
02B2 0E0F MOVLW 0xf
02B4 6E52 MOVWF 0x52, ACCESS
02B6 DF2E RCALL 0x114
276:
277: LCD_COM(0X11);
02B8 0E11 MOVLW 0x11
02BA 6E50 MOVWF 0x50, ACCESS
02BC DF26 RCALL 0x10a
278: delay_ms(120);
02BE 0E78 MOVLW 0x78
02C0 6E2E MOVWF 0x2e, ACCESS
02C2 DF0A RCALL 0xd8
279: LCD_COM(0X29);
02C4 0E29 MOVLW 0x29
02C6 6E50 MOVWF 0x50, ACCESS
02C8 DF20 RCALL 0x10a
02CA EF30 GOTO 0x660
--- C:\Users\m-a-c\Documents\CLOCK\SOFTWARE\PIC18F46K22\LCD_SCREENS.c --------------------------
1: void START_SCN()
2: {
3: CCD=9;
4: LCD_FILL(0, 0, 480, 320);
5: CCD=1; //WHITE
6: LCD_FILL(0, 0, 60, 325);
7: CCD=4; //YELLOW
8: LCD_FILL(61, 0, 121, 320);
9: CCD=6; //CYAN
10: LCD_FILL(122, 0, 182, 320);
11: CCD=5; //GREEN
12: LCD_FILL(183, 0, 243, 320);
13: CCD=8; //MAGENTA
14: LCD_FILL(244, 0, 304, 320);
15: CCD=3; //RED
16: LCD_FILL(305, 0, 365, 320);
17: CCD=2; //BLUE
18: LCD_FILL(366, 0, 426, 320);
19: }
20: void CLOCK_SCN()
21: {
22: // if(!LCK0)
23: // {
24: // CCD=1;
25: // AUX0=HORAS/10;
26: // AUX1=HORAS-AUX0*10;
27: // LCD_PLT(AUX0, 65, 18); //HORAS PRIMEIRO DÍGITO
28: // LCD_PLT(AUX1, 150, 18); //HORAS SEGUNDO DÍGITO
29: // AUX0=MINUTOS/10;
30: // AUX1=MINUTOS-AUX0*10;
31: // LCD_PLT(AUX0, 260, 18); //MINUTOS PRIMEIRO DÍGITO
32: // LCD_PLT(AUX1, 345, 18); //MINUTOS SEGUNDO DÍGITO
33: // LCD_HLINE(0, 159, 480);
34: // LCD_HLINE(0, 160, 480);
35: // LCD_HLINE(0, 161, 480);
36: // }
37: if(TIKTAK)
0582 A01E BTFSS 0x1e, 0, ACCESS
0584 D014 BRA 0x5ae
38: {
39: CCD=1;
0586 0E01 MOVLW 0x1
0588 6E1A MOVWF 0x1a, ACCESS
40: LCD_DRAW(CLK_DP, 229, 49, 21, 58); //ACENDE PONTOS DO RELOGIO
058A 0ED5 MOVLW 0xd5
058C 6E2F MOVWF 0x2f, ACCESS
058E 0E22 MOVLW 0x22
0590 6E2E MOVWF 0x2e, ACCESS
0592 6A31 CLRF 0x31, ACCESS
0594 0EE5 MOVLW 0xe5
0596 6E30 MOVWF 0x30, ACCESS
0598 6A33 CLRF 0x33, ACCESS
059A 0E31 MOVLW 0x31
059C 6E32 MOVWF 0x32, ACCESS
059E 6A35 CLRF 0x35, ACCESS
05A0 0E15 MOVLW 0x15
05A2 6E34 MOVWF 0x34, ACCESS
05A4 6A37 CLRF 0x37, ACCESS
05A6 0E3A MOVLW 0x3a
05A8 6E36 MOVWF 0x36, ACCESS
05AA D77F BRA 0x4aa
41: }
05AC D00F BRA 0x5cc
42: else
43: {
44: CCD=7; //BLACK
05AE 0E07 MOVLW 0x7
05B0 6E1A MOVWF 0x1a, ACCESS
45: LCD_Fill(229, 49, 21, 58); //APAGA PONTOS DO RELOGIO
05B2 6A2F CLRF 0x2f, ACCESS
05B4 0EE5 MOVLW 0xe5
05B6 6E2E MOVWF 0x2e, ACCESS
05B8 6A31 CLRF 0x31, ACCESS
05BA 0E31 MOVLW 0x31
05BC 6E30 MOVWF 0x30, ACCESS
05BE 6A33 CLRF 0x33, ACCESS
05C0 0E15 MOVLW 0x15
05C2 6E32 MOVWF 0x32, ACCESS
05C4 6A35 CLRF 0x35, ACCESS
05C6 0E3A MOVLW 0x3a
05C8 6E34 MOVWF 0x34, ACCESS
05CA DEE6 RCALL 0x398
46: }
47: TIKTAK=!TIKTAK;
05CC 701E BTG 0x1e, 0, ACCESS
48: // LCK0=1;
49: CLK=0;
05CE 921E BCF 0x1e, 0x1, ACCESS
05D0 EF41 GOTO 0x682
|
And this is my program so far:
Code: |
#include <18F46K22.h>
#fuses NOWDT, NOFCMEN, NOIESO, NOCPD, NOPROTECT, NOLVP, NODEBUG, PUT, BROWNOUT, NOMCLR
#use DELAY(INTERNAL=64MHz)
#use FAST_IO(A)
//#use FAST_IO(B)
#use FAST_IO(C)
//#use FAST_IO(D)
#use FAST_IO(E)
#byte PORTA=0xF80
#byte PORTB=0xF81
#byte PORTC=0xF82
//#byte PORTD=0xF83
#byte PORTE=0xF84
#bit LCD_WR=PORTB.1 //LCR WRITE PIN
#bit LCD_RS=PORTB.2 //LCD REGISTER / COMMAND
#bit LCD_REST=PORTB.3 //LCD RESET PIN
#bit LCD_CS=PORTB.4 //LCD CHIP SELECT PIN
//VARIÁVEIS DE SISTEMA
int PAGE=0, CCD, AUX0, AUX1, AUX2;
int FLAG0=0, FLAG1=0, FLAG2=0;
long COLLOR;
//VARIÁVEIS DE RELÓGIO
int HORAS=0, MINUTOS=0, SEGUNDOS, DOW, DAY, MONTH, YEAR;
int HV1=0XFF, HV2=0XFF, MV1=0XFF, MV2=0XFF;
#bit TIKTAK=FLAG0.0 //FLAG PARA DESENHAR PONTOS DO RELÓGIO
#bit CLK=FLAG0.1 //FLAG DE PONTOS DO RELÓGIO
#bit LCK0=FLAG2.0 //LOCKS HLINE DRAWING CLOCK SCREEN
//INCLUDES
#include<BITMAP.c>
#include<LCD_CMD.c>
#include<LCD_SCREENS.c>
void main()
{
PORT_B_PULLUPS(FALSE);
SETUP_ADC_PORTS(NO_ANALOGS);
SETUP_COMPARATOR(NC_NC_NC_NC);
SETUP_COUNTERS(RTCC_INTERNAL,RTCC_DIV_1);
SETUP_TIMER_1(T1_DISABLED|T1_DIV_BY_8);
SETUP_TIMER_2(T2_DISABLED,0XFF,16);
SETUP_TIMER_3(T3_DISABLED);
SET_TRIS_A(0b11111111);
SET_TRIS_B(0b11100001);
SET_TRIS_C(0b00000000);
// SET_TRIS_D(0b11111111);
SET_TRIS_E(0b11111111);
EXT_INT_EDGE(L_TO_H);
ENABLE_INTERRUPTS(INT_EXT); //ENABLE RTC INTERRUPTS
// ENABLE_INTERRUPTS(INT_CCP1); //INABLE INFRARED INTERRUPTION
ENABLE_INTERRUPTS(GLOBAL); //ENABLE GLOBAL INTERRUPTS
LCD_INIT();
// START_SCN();
// DELAY_MS(5000);
CCD=7;
LCD_FILL(0, 0, 480, 320); //CLEAR LCD
loop:
while(1) //INICIALIZAÇÃO
{
if(CLK)CLOCK_SCN();
}
goto loop;
}
#INT_EXT //RTC INTERRUPTION SERVICE ROUTINE
void RB0_ISR(void)
{
SEGUNDOS++;
if(SEGUNDOS==60)
{
SEGUNDOS=0;
MINUTOS++;
LCK0=0;
TIKTAK=0; //sincroniza pontos do relógio
}
if(MINUTOS==60)
{
MINUTOS=0;
HORAS++;
}
if(HORAS==24)HORAS=0;
// if(!HORAS&&!MINUTOS&&SEGUNDOS==5)RTC_GDT=1; //GET NEW DATE WHEN CLOCK IS SHOWED
CLK=1;
}
|
Don't have any idea how to solve this, and never get this error before. May be something is wrong in the EXT ISR configuration, I don't know, please help me!
Regards. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9228 Location: Greensville,Ontario
|
|
Posted: Tue Jan 18, 2022 7:04 am |
|
|
you enable an interrupt for the CCP but I don't see the 'handler', the 'INT_CCP{}..... code If you don't have the ISR code, eventually the PIC program will crash.
you say you use an RTC, which one ? also why update sec,min,hrs in the ISR why not just read the RTC.Also most(all ?) require a 'setup' or 'initialization' . |
|
|
rudy
Joined: 27 Apr 2008 Posts: 167
|
|
Posted: Tue Jan 18, 2022 7:07 am |
|
|
Hum.....
The CCP interrupt is commented, it is not enable.
I just GET the time at the beginning, them I update the clock by 1Hz output.
Please don't pay attention to this now ok? Just want to know this strange behavior.
Regards; |
|
|
rudy
Joined: 27 Apr 2008 Posts: 167
|
|
Posted: Tue Jan 18, 2022 7:42 am |
|
|
Somehow! it is solved!
Really don't know what happened! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 18, 2022 9:00 am |
|
|
Quote: | Somehow! it is solved!
|
What if the problem reoccurs when the product is in production and
is in the hands of customers ? What if it's an intermittent problem ?
A proper engineer would not want this or allow it. A proper engineer
would want to find out why the problem occurred, and fix it. |
|
|
rudy
Joined: 27 Apr 2008 Posts: 167
|
|
Posted: Tue Jan 18, 2022 9:05 am |
|
|
You are right!
But this is only for me, my use, not to sell to anybody!
The problem were in the include file, the device I choose was 18F46K22, and not the 18F26K22. When I changed to correct device, the problem vanishes.
My mistake as usual.....
Sorry, and thank all of you!
Regards. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|