We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
After changing a sbit in bdata Anzeigst ACC must be updated before sending the byte to AnzDaten _at_ 0xff86. For one time it's ok. Second and more acc is not updated. What's wrong ? W. Gehling stmt level source 1 #include <reg515.h> 2 3 #define ucx unsigned char xdata 4 #define ucb unsigned char bdata 5 6 ucb Anzeigst; // bitadressierbares Byte zur Anzeigensteuerung 7 ucb Ant; // bitadressierbares Byte zur Anzeigensteuerung 8 ucx AnzDaten _at_ 0xff86; /* IC3 , Datenzwischenspeicher fuer die 9 Anzeigewerte haelt die Daten zur 10 Uebernahme mit "STRIH" bereit */ 11 ucx AnzSteuer _at_ 0xff87; /* IC4, Steuersignale */ 12 13 sbit STRWAHL = Anzeigst^0; // Bit zur Uebernahme der jeweiligen Anzeigenwahl 14 sbit BLINHIB = Anzeigst^1; // Bit zur Aktivierung der angewaehlten Blinkstellen 15 sbit BLIWA = Anzeigst^3; // Bit zur Uebernahme der jeweiligen Blinkstellen-Wahl 16 sbit STRIH = Anzeigst^4; // Bit zur Uebernahme der Anzeigewerte in die LC-Treiber 17 18 void main(void) 19 { 20 1 while(1) 21 1 { 22 2 23 2 24 2 STRIH = 1; 25 2 26 2 AnzSteuer = Anzeigst; // und in 'AnzSteuer' IC4 auf SN_IOxx 27 2 28 2 BLIWA = 1; // Uebernahmebit fuer IC48 im Bit-Speicher 'Anzeigst' 29 2 30 2 AnzSteuer = Anzeigst; // und in 'AnzSteuer' IC4 auf SN_IOxx 31 2 32 2 BLIWA = 0; 33 2 34 2 AnzSteuer = Anzeigst; // und in 'AnzSteuer' IC4 auf SN_IOx 35 2 } 36 1 37 1 38 1 39 1 } C51 COMPILER V4.01, TT 07/08/02 10:47:28 PAGE 2 ASSEMBLY LISTING OF GENERATED OBJECT CODE ; FUNCTION main (BEGIN) ; SOURCE LINE # 18 ; SOURCE LINE # 19 0000 ?C0001: ; SOURCE LINE # 20 ; SOURCE LINE # 21 ; SOURCE LINE # 24 0000 D200 R SETB STRIH ; SOURCE LINE # 26 0002 90FF87 MOV DPTR,#AnzSteuer 0005 E500 R MOV A,Anzeigst 0007 F0 MOVX @DPTR,A ; SOURCE LINE # 28 0008 D200 R SETB BLIWA ; SOURCE LINE # 30 000A F0 MOVX @DPTR,A ; SOURCE LINE # 32 000B C200 R CLR BLIWA ; SOURCE LINE # 34 000D F0 MOVX @DPTR,A ; SOURCE LINE # 35 000E 80F0 SJMP ?C0001 ; SOURCE LINE # 39 0010 22 RET ; FUNCTION main (END)
It looks like the reloading of the Acc is being optomized out by the compiler. Either turn off compiler optimization or declare 'Anzeigst' as volatile. These should work. Best luck Scott
Thank you all W. Gehling