- MultiPlus Wechselrichter Insel und Nulleinspeisung Conrad         
Seite 2 von 4 ErsteErste 1234 LetzteLetzte
Ergebnis 11 bis 20 von 38

Thema: C-Programm auf XC866 'verzählt' sich

  1. #11
    Super-Moderator Robotik Visionär Avatar von PicNick
    Registriert seit
    23.11.2004
    Ort
    Wien
    Beiträge
    6.842
    Anzeige

    Powerstation Test
    Ah, danke. sieht ok aus (die switch-Interpretation ist listig, sieht man nicht oft in der Form)
    Du setzt "Edge Selection". Schaust du mal, ob das wirklich für "rising / falling" gilt oder womöglich für beides ?
    Du brauchst doch entweder "Level" oder definitiv nur eines von rise/fall
    (das steht im Datasheet).
    Diagnose vom Doktor: Der interrupt-Code ist so oder so o.k.
    Entweder hat's was mit der ISR-Definition oder eben doch was elektrisches.
    tscha
    mfg robert
    Wer glaubt zu wissen, muß wissen, er glaubt.

  2. #12
    Ampfing
    Gast

    Habs gelöst, aber warum es passiert weiß ich immer noch nich

    Hallo Robert,

    ich muss ehrlich zugeben, ich habe auch ne Zeit gebraucht, bis ich verstanden habe, wozu der switch umgebaut wurde.
    Hab nochmal nachgeschaut, ich habe tatsächlich nur auf positive Flanke getriggert.
    Mittlerweile habe ich das Problem auch eingegrenzt und behoben (zumindest von der Software-Seite)!
    Es war ehrlich gesagt nicht ganz so, wie ich es am Anfang gepostet hatte. Der 2. Interrupt wird nur ausgelöst, wenn im 1. Byte das höchstwertige Bit gesetzt ist! Dann und nur dann wird bei der Übertragung des 2. Bytes ein 2. Interrupt generiert und er macht Schrott.
    Hab das jetzt einfach so abgefangen:
    Code:
    case 1:
    	time2 = P3_DATA;
    	if (time1 > 127 && error == 1)
    	{
    		error = 0;
    		counter--;
    	}
    	break;
    error ist nochmal ein Bit, damit ich weiß, ob ich das erste mal in den case reinlaufe oder nicht.
    Das funktioniert zumindest mal - auch wenn ich nach wie vor nicht weiß, warum der 2. Interrupt ausgelöst wird. Das wird wohl das Geheimnis des Controllers bleiben...

    Vielen Dank für deine tatkräftige Unterstützung und viele Grüße
    Michael

  3. #13
    Super-Moderator Robotik Visionär Avatar von PicNick
    Registriert seit
    23.11.2004
    Ort
    Wien
    Beiträge
    6.842
    Seltsam.
    Das einzige, was mir auffällt, aber ich seh auch keinen Grund darin:
    du definierst
    volatile unsigned char counter;
    volatile unsigned char time1, time2, time3;
    volatile unsigned char phase;
    Er ändert aber die Folge
    counter 08
    phase 09
    time1 0a
    time2 0b
    time3 0c

    Wieso eigentlich ?
    alphabetisch isses nicht, reihefolge vorkommen auch nicht
    mfg robert
    Wer glaubt zu wissen, muß wissen, er glaubt.

  4. #14
    Ampfing
    Gast
    Ich weiß ehrlich gesagt nicht, warum er die Reihenfolge ändert.
    Aber das ist doch alphabetisch, oder? (p kommt meines Wissens vor t und nach c)

    Ich weiß nur, dass es jetzt endlich funktioniert und dass ich überglücklich bin, weil mein restliches Programm jetzt auch funzt!!!! \/

    Was ich noch so an Ideen hatte, warum es nicht funktionieren könnte:
    Wenn in time1 das msb gesetzt ist und er es in die Variable schiebt könnte ja irgendein Überlauf stattfinden, der durch einen dummen Zufall genau das IR-Bit des Interrupts setzt. Aber das kann eigentlich auch nicht sein, da das Register EXICON0 (mit dem IR-Bit) wo ganz anders liegt - irgendwas mit 0xaX (das X is auch noch ne Zahl...). Außerdem hätte das ja dann weg sein müssen, als ich nen anderen Interruptkanal probiert habe.
    Was auch immer es ist, es bleibt wohl oder übel das Geheimnis des Controllers (und vielleicht auch von Infineon).

    Nochmal vielen vielen Dank, dass du dir soviel Zeit für mein Problem genommen hast!!! Ich hoffe mal, ich habe dich nicht zu sehr vom Arbeiten abgehalten!?

  5. #15
    Super-Moderator Robotik Visionär Avatar von PicNick
    Registriert seit
    23.11.2004
    Ort
    Wien
    Beiträge
    6.842
    Du hast recht, alphabet sollt man können
    Wenn's geht, ist das schon mal fein.
    Is halt blöd, daß man nicht weiß, warums NICHT geht, und jetzt eigentlich nicht weiß, warum es jetzt SCHON geht.
    Tu mir aber vielleicht die Liebe und poste das ganze, das ja jetzt funzt, nochmal rein, ich möcht mir das unter den Kopfpolster legen.
    Meine Arbeit ist ohnehin genau die gleiche: Fehler in Programmen suchen, die ich vorher selbst reingeschrieben habe.
    mfg robert
    Wer glaubt zu wissen, muß wissen, er glaubt.

  6. #16
    Ampfing
    Gast
    Okay, poste ich morgen (hab den anderen Rechner schon aus). Alternativ kann ich dir das Ganze natürlich auch gerne zuschicken, wenn dir das lieber ist!?
    Viele Grüße und viel Spaß beim Fehler suchen

  7. #17
    Super-Moderator Robotik Visionär Avatar von PicNick
    Registriert seit
    23.11.2004
    Ort
    Wien
    Beiträge
    6.842
    Hast Recht, den Tag immer bei einem Erfolg sofort beenden, das sicher den Schlaf
    mfg robert
    Wer glaubt zu wissen, muß wissen, er glaubt.

  8. #18
    Ampfing
    Gast

    das Programm

    Guten Morgen,

    im Anschluss also das momentan aktuelle Programm. Ich kann dir aber noch nicht versprechen, dass es 100%ig gleich bleiben wird, aber viel wird sich auf jeden Fall nicht mehr ändern.
    Wenn dich 'nur' der problematische Programmteil interessiert schau einfach nur in die Datei int.c (und da in die Funktion TriggerISR), ich poste hier mal mein komplettes Programm (+ Disassembly).
    Viele Grüße nach Wien
    Michael

    Datei main.c:
    Code:
    #include "main.h"
    #include "io.h"
    
    //declaration of functions
    extern void PortInit(void);				//declared in ports.c
    extern void TimerInit(void);			//declared in timer.c
    extern void InterruptInit(void);		//declared in int.c
    extern void Shoot (void);				//declared in int.c
    extern void CorrectTimes(void);			//declared in timer.c
    
    //declaration of variables
    volatile unsigned char counter;					//counter variable for number of trigger events
    volatile unsigned char time1, time2, time3;		//time in ms (LSB to MSB)
    volatile unsigned char phase;					//phase information
    volatile bit usePhase;							//0 if phase is not used, 1 if phase is used
    volatile bit ready;								//0 if shoot paused, 1 if shoot is performed
    volatile bit mainc;								//1 if main contactor is used, else 0
    volatile bit europe;							//1 if f=50Hz (European), 0 if f=60Hz (American)
    
    extern volatile bit error;						//declared in int.c
    
    /*--------------------------------------------------------------*/
    /*	function main												*/
    /*	initalizes the controller, executes the program				*/
    /*	no input, no return value									*/
    
    void main (void)
    {
    	PortInit();						//initialize the ports
    	TimerInit();					//initialize the timers
    	InterruptInit();				//initialize the trigger-interrupts
    	counter = 0;					//set starting value for counter
    	ready = 0;						//shoot must not be performed yet
    	EA = 1;							//enable all interrupts globaly
    
    	while(counter < 5);			//wait for 5 transmissions from the computer
    	finished = 0;				//reset finished bit
    	if ((phase & 0x80) == 0)
    	{
    		europe = 0;
    	}
    	else
    	{
    		europe = 1;
    	}
    	if (mainc == 1)
    	{
    		P0_DATA |= 0x2;			//close the serial contactors (shoot is performed with main contactor)
    	}
    	else
    	{
    		P0_DATA |= 0x1;			//close the main contactor (shoot is performed with serial contactors)
    	}
    	CorrectTimes();				//corrects time1 to time3
    
    	while(ready == 0);			//wait for shoot-signal from computer
    	if (usePhase == 1)
    	{
    		IRCON0 &= 0xfd;			//reset IR-Bit of null-phase
    		while ((IRCON0 & 0xfd) == 0);	//wait for IR-Bit of null-phase
    		if (europe == 1)
    		{
    			TR0 = 1;			//start T0 (for 50Hz)
    			while (phase > 0);	//wait until signal has desired phase
    			TR0 = 0;			//stop T0
    		}
    		else
    		{
    			TR1 = 1;			//start T1 (for 60Hz)
    			while (phase > 0);	//wait until signal has desired phase
    			TR1 = 0;			//stop TR1
    		}
    	}
    	Shoot();					//perform the shoot
    	while(1);
    }
    //end of function main()
    Datei int.c:
    Code:
    #include "main.h"
    
    //declaration of functions
    void ResetShoot(void);
    void Shoot(void);
    
    //declaration of variables
    volatile bit error;											//to correct counter if necessary
    extern volatile unsigned char counter;					 	//declared in main.c
    extern volatile unsigned char time1, time2, time3, phase;	//declared in main.c
    extern volatile bit usePhase;								//declared in main.c
    extern volatile bit mainc, ready;							//declared in main.c
    
    /*------------------------------------------------------*/
    /*	function InterruptInit								*/
    /*	initializes the trigger-interrupts					*/
    /*	no input, no return value							*/
    /*	shoot -> EXINT2	(both edges)									
    	trigger -> EXINT3 (rising edge)
    	phase -> EXINT1 (rising edge) NOT ACTIVATED!!!		*/
    
    void InterruptInit(void)
    {
    	//set priorities of interrupts (shoot = 2, trigger and phase = 1)
    	IP1 = 0x8;							//reset bit for shoot, set bit for trigger
    	IPH1 = 0x4;							//set bit for shoot, reset bit for trigger
    	IP |= 0x4;							//set bit for phase
    	IPH = 0x3b;							//reset bit for phase
    
    	EXICON0 = 0x64;						//edge selection for the three signals
    	IEN0 &= 0xfb;						//disable interrupt for phase (individually)
    	IEN1 |= 0x4;						//enable interrupt for the shoot(individually)
    	IEN1 |= 0x8;						//enable interrupt for trigger  (individually)
    	error = 1;
    }
    //end of function InterruptInit()
    
    /*------------------------------------------------------*/
    /*	function TriggerISR									*/
    /*	ISR for trigger signal to latch time and phase		*/
    /*	no input, no return value							*/
    
    void TriggerISR() interrupt 9
    {
    	switch (counter)
    	{
    		case 0:
    			time1 = P3_DATA; 		//get LSB of time
    			break;
    
    		case 1:
    			time2 = P3_DATA;		//get 2nd byte of time
    			if (time1 > 127 && error == 1)
    			{
    				error = 0;
    				counter--;
    			}
    			break;
    
    		case 2:
    			time3 = P3_DATA;	  	//get MSB of time
    			break;
    
    		case 3:
    			phase = P3_DATA;		//get phase information
    			break;
    
    		case 4:
    			switch (P3_DATA)
    			{
    				case 0:
    					usePhase = 0;		  	//-> phase ignored
    					mainc = 0;				//use serial contactors
    					break;
    				case 1:
    					usePhase = 1;			//-> phase important
    					mainc = 0;				//use serial contactors
    					break;
    				case 2:
    					usePhase = 0;	 		//-> phase ignored
    					mainc = 1;				//use main contactor
    					break;
    				case 3:
    					usePhase = 1;			//-> phase important
    					mainc = 1;				//use main contactor
    					break;
    				default:
    					break;
    			}
    			break;
    
    		default:
    			break;
    	}
    	counter++;								//increase counter value by 1
    	IRCON0 &= 0xf7;							//reset IR-Bit of trigger
    }
    //end of function TriggerISR()
    
    /*------------------------------------------------------*/
    /*	function ShootISR									*/
    /*	ISR for pin shoot -> start or pause shoot			*/
    /*	no input, no return value							*/
    
    void ShootISR () interrupt 8
    {
    	if ((P2_DATA & 0x2) == 0)		//-> Interrupt on falling edge
    	{
    		ResetShoot();				//open the contactor
    		ready = 0;					//reset ready-bit
    	}
    	else
    	{
    		if (counter > 0) 			//if first IR on rising edge->maybe use phase information
    		{
    			ready = 1;				//just set the ready bit (shoot performed by main())
    		}
    		else
    		{		
    			Shoot();				//close the contactors
    			ready = 1;				//set the ready-bit
    		}
    	}
    	IRCON0 &= 0xfb;					//reset IR-Bit of shoot
    }
    //end of function ShootISR()
    
    /*------------------------------------------------------*/
    /*	function ResetShoot									*/
    /*	stops the shoot										*/
    /*	no input, no return value							*/
    
    void ResetShoot()
    {
    	TR2 = 0;						//stop T2
    	if (mainc == 1)
    	{
    		P0_DATA &= 0xfe;			//open the main contactor
    	}
    	else
    	{
    		P0_DATA &= 0xfd;			//open the serial contactors
    	}
    }
    //end of function ResetShoot()
    
    /*------------------------------------------------------*/
    /*	function Shoot										*/
    /*	closes the relais for the shoot and starts T2		*/
    /*	no input, no return value							*/
    
    void Shoot()
    {
    	if (mainc == 1)
    	{
    		P0_DATA |= 0x1;				//close the main contactor
    	}
    	else
    	{
    		P0_DATA |= 0x2;				//close the serial contactors
    	}
    	TR2 = 1;						//start T2
    }
    //end of function Shoot()

  9. #19
    Ampfing
    Gast

    Programm II.

    Durfte leider nicht alles auf einmal posten, deshalb hier der zweite Teil.

    Datei timer.c:
    Code:
    #include "main.h"
    #include "io.h"
    
    //declaration of functions
    void CorrectTimes();
    
    extern void ResetShoot();
    
    //declaration of variables
    volatile unsigned char idata stepsT0;				//counter for steps of T0 for 1ms
    volatile unsigned char idata stepsT1;				//counter for steps of T1 for 1ms
    volatile unsigned char correctTime2;				//to save value of correction for time2
    
    extern volatile unsigned char phase;				//declared in main.c
    extern volatile unsigned char time1, time2, time3;	//declared in main.c
    extern volatile bit ready;							//declared in main.c
    
    /*------------------------------------------------------*/
    /*	function TimerInit									*/
    /*	initializes the timers of controller				*/
    /*	no input, no return-value							*/
    /*	timer 0 generates 7,94µs for 50Hz,
    	timer 1 generates 5,78µs for 60Hz					*/
    
    void TimerInit(void)
    {
    	TMOD = 0x22;			//T0 and T1 run in 8bit timer mode with auto reload
    	TL0 = TH0 = 150;		//load T0 and its reload register with value for 7,94µs
    	TL1 = TH1 = 179;		//load T1 and its relaod register with value for 5,78µs
    
    	T2MOD = 0;				//prescaler is disabled, up-down is disabled, no edge selection (tm)
    	T2CON = 0;				//reload mode, timer is stopped, no external events allowed
    	T2H = RC2H = 0xf7;		//load high bytes of timer 2 and reload with value for 1ms
    	T2L = RC2L = 0x52;		//load low bytes of timer 2 and reload with value for 1ms
    
    	IEN0 |= 0x2a;			//enable all three timer interrupts (individually)
    	IP |= 0x2a;				//set all three interrupts to priority 1
    	IPH = 0xd5;				//set all three interrupts to priority 1
    
    	stepsT0 = 21;			//21 overflows of T0 necessary for 166,95µs (3° with f=50Hz)
    	stepsT1 = 24;			//24 overflows of T1 necessary for 138,6µs (3° with f=60Hz)
    }
    //end of function TimerInit()
    
    /*------------------------------------------------------*/
    /*	function T2ISR										*/
    /*	ISR for timer 2										*/
    /*	no input, no return value							*/
    
    void T2ISR() interrupt 5
    {
    	TF2 = 0;					//clear the IR bit!
    	if (time1 == 0)
    	{
    		if (time2 == 0)
    		{
    			if (correctTime2 == 0)
    			{
    				if (time3 == 0)
    				{
    					P0_DATA &= 0xfc;			//open the contactors as test is finished
    					finished = 1;				//signal the computer that test is finished
    					correctTime2 = 0;			//reset the correction time for next shoot
    					ready = 0;					//reset the ready bit -> no shoot must be performed
    				}
    				else
    				{
    					time3--;					//decrease MSB of time
    					time2 = 0xff;				//set time2 to 255
    					time1 = 0xff;				//set LSB of time to 255
    				}
    			}
    			else
    			{
    				time2 = correctTime2;			//correct time2
    				time1 = 0xff;					//set LSB of time to 255
    				correctTime2 = 0;				//reset time correction
    			}
    		}
    		else
    		{
    			time2--;							//decrease 2nd byte of time
    			time1 = 0xff;						//set LSB of time to 255
    		}
    	}
    	else
    	{
    		time1--;								//decrese LSB of time
    	}	
    	P3_6 =~ P3_6;								//toggle diode (for testing only!!)
    }
    //end of function T2ISR()
    
    /*------------------------------------------------------*/
    /*	function T0ISR										*/
    /*	ISR for timer 0										*/
    /*	no input, no return value							*/
    
    void T0ISR() interrupt 1
    {
    	stepsT0--; 									//decrease steps for 3° (50Hz)
    	if (stepsT0 == 0)							//if time for 3° has passed
    	{
    		stepsT0 = 21;							//reload steps for 3°
    		phase--;								//decrease phase
    	}
    }
    //end of function T0ISR()
    
    /*------------------------------------------------------*/
    /*	function T1ISR										*/
    /*	ISR for timer 1										*/
    /*	no input, no return value							*/
    
    void T1ISR() interrupt 3
    {
    	stepsT1--;									//decrease steps for 3° (60Hz)
    	if (stepsT1 == 0)							//if time for 3° has passed
    	{
    		stepsT1 = 24;							//reload steps for 3°
    		phase--;								//decrease phase
    	}
    }
    //end of function T1ISR()
    
    /*------------------------------------------------------*/
    /*	function CorrectTime								*/
    /*	corrects time1 to time3								*/
    /*	no input, no return value							*/
    
    void CorrectTimes()
    {
    	switch (time3)
    	{
    		case 0:
    			if (time1 != 0 || time2 == 0)
    			{
    				time1--;
    			}
    			else
    			{
    				if (time1 == 0)
    				{
    					time2--;
    					time1 = 0xff;
    				}
    			}
    			break;
    		
    		default:
    			correctTime2 = time3;
    			if (time1 == 0)
    			{
    				time2--;
    				time1 = 0xff;
    			}
    			else
    			{
    				time1--;
    			}
    			break;
    	}
    }
    //end of function CorrectTimes()
    Datei ports.c:
    Code:
    #include "main.h"
    #include "io.h"
    
    //declaration of functions
    void PortInit();
    
    
    /*------------------------------------------------------*/
    /*	function PortInit									*/
    /*	initializes the direction of ports					*/
    /*	no input, no return-value							*/
    
    
    void PortInit(void)
    {
    	P0_DIR = 0xb;				//P0.0, P0.1 and P0.3 are outputs
    	P1_DIR = 0x0;				//P1.1 is an input
    	P3_DIR = 0x0;				//P3.0 to P3.7 are inputs
    	//for testing:
    	P1_DIR |= 0xc0;				//P1.6 and P1.7 are outputs
    	P0_DIR |= 0x4;				//P0.2 is an output	
    }
    //end of function PortInit()
    Disassembly:
    Code:
                     main:
    C:0x086F    120A25   LCALL    PortInit(C:0A25)
    C:0x0872    120966   LCALL    TimerInit(C:0966)
    C:0x0875    1209BC   LCALL    InterruptInit(C:09BC)
    C:0x0878    E4       CLR      A
    C:0x0879    F508     MOV      counter(0x08),A
    C:0x087B    C202     CLR      ready(0x20.2)
    C:0x087D    D2AF     SETB     EA(0xA8.7)
    C:0x087F    E508     MOV      A,counter(0x08)
    C:0x0881    C3       CLR      C
    C:0x0882    9405     SUBB     A,#0x05
    C:0x0884    40F9     JC       C:087F
    C:0x0886    C283     CLR      finished(0x80.3)
    C:0x0888    E509     MOV      A,phase(0x09)
    C:0x088A    20E704   JB       0xE0.7,C:0891
    C:0x088D    C201     CLR      europe(0x20.1)
    C:0x088F    8002     SJMP     C:0893
    C:0x0891    D201     SETB     europe(0x20.1)
    C:0x0893    300005   JNB      mainc(0x20.0),C:089B
    C:0x0896    438002   ORL      P0_DATA(0x80),#0x02
    C:0x0899    8003     SJMP     C:089E
    C:0x089B    438001   ORL      P0_DATA(0x80),#0x01
    C:0x089E    120997   LCALL    CorrectTimes(C:0997)
    C:0x08A1    3002FD   JNB      ready(0x20.2),C:08A1
    C:0x08A4    300324   JNB      usePhase(0x20.3),C:08CB
    C:0x08A7    53B4FD   ANL      IRCON0(0xB4),#CCU6_CC61RH(0xFD)
    C:0x08AA    E5B4     MOV      A,IRCON0(0xB4)
    C:0x08AC    54FD     ANL      A,#CCU6_CC61RH(0xFD)
    C:0x08AE    60FA     JZ       C:08AA
    C:0x08B0    30010D   JNB      europe(0x20.1),C:08C0
    C:0x08B3    D28C     SETB     TR0(0x88.4)
    C:0x08B5    E509     MOV      A,phase(0x09)
    C:0x08B7    D3       SETB     C
    C:0x08B8    9400     SUBB     A,#0x00
    C:0x08BA    50F9     JNC      C:08B5
    C:0x08BC    C28C     CLR      TR0(0x88.4)
    C:0x08BE    800B     SJMP     C:08CB
    C:0x08C0    D28E     SETB     TR1(0x88.6)
    C:0x08C2    E509     MOV      A,phase(0x09)
    C:0x08C4    D3       SETB     C
    C:0x08C5    9400     SUBB     A,#0x00
    C:0x08C7    50F9     JNC      C:08C2
    C:0x08C9    C28E     CLR      TR1(0x88.6)
    C:0x08CB    120A34   LCALL    Shoot(C:0A34)
    C:0x08CE    80FE     SJMP     C:08CE
    
                     ShootISR:
    C:0x08D0    C0E0     PUSH     ACC(0xE0)
    C:0x08D2    C0F0     PUSH     B(0xF0)
    C:0x08D4    C083     PUSH     DPH(0x83)
    C:0x08D6    C082     PUSH     DPL(0x82)
    C:0x08D8    C0D0     PUSH     PSW(0xD0)
    C:0x08DA    75D000   MOV      PSW(0xD0),#0x00
    C:0x08DD    C000     PUSH     0x00
    C:0x08DF    C001     PUSH     0x01
    C:0x08E1    C002     PUSH     0x02
    C:0x08E3    C003     PUSH     0x03
    C:0x08E5    C004     PUSH     0x04
    C:0x08E7    C005     PUSH     0x05
    C:0x08E9    C006     PUSH     0x06
    C:0x08EB    C007     PUSH     0x07
    C:0x08ED    E5A0     MOV      A,PPAGE_SFR(0xA0)
    C:0x08EF    20E107   JB       0xE0.1,C:08F9
    C:0x08F2    120A42   LCALL    ResetShoot(C:0A42)
    C:0x08F5    C202     CLR      ready(0x20.2)
    C:0x08F7    8010     SJMP     C:0909
    C:0x08F9    E508     MOV      A,counter(0x08)
    C:0x08FB    D3       SETB     C
    C:0x08FC    9400     SUBB     A,#0x00
    C:0x08FE    4004     JC       C:0904
    C:0x0900    D202     SETB     ready(0x20.2)
    C:0x0902    8005     SJMP     C:0909
    C:0x0904    120A34   LCALL    Shoot(C:0A34)
    C:0x0907    D202     SETB     ready(0x20.2)
    C:0x0909    53B4FB   ANL      IRCON0(0xB4),#CCU6_CC60RH(0xFB)
    C:0x090C    D007     POP      0x07
    C:0x090E    D006     POP      0x06
    C:0x0910    D005     POP      0x05
    C:0x0912    D004     POP      0x04
    C:0x0914    D003     POP      0x03
    C:0x0916    D002     POP      0x02
    C:0x0918    D001     POP      0x01
    C:0x091A    D000     POP      0x00
    C:0x091C    D0D0     POP      PSW(0xD0)
    C:0x091E    D082     POP      DPL(0x82)
    C:0x0920    D083     POP      DPH(0x83)
    C:0x0922    D0F0     POP      B(0xF0)
    C:0x0924    D0E0     POP      ACC(0xE0)
    C:0x0926    32       RETI 
        
                     T2ISR:
    C:0x0927    C0E0     PUSH     ACC(0xE0)
    C:0x0929    C2C7     CLR      TF2(0xC0.7)
    C:0x092B    E50A     MOV      A,time1(0x0A)
    C:0x092D    7030     JNZ      C:095F
    C:0x092F    E50B     MOV      A,time2(0x0B)
    C:0x0931    7025     JNZ      C:0958
    C:0x0933    E50D     MOV      A,correctTime2(0x0D)
    C:0x0935    7016     JNZ      C:094D
    C:0x0937    E50C     MOV      A,time3(0x0C)
    C:0x0939    700B     JNZ      C:0946
    C:0x093B    5380FC   ANL      P0_DATA(0x80),#CCU6_T13L(0xFC)
    C:0x093E    D283     SETB     finished(0x80.3)
    C:0x0940    F50D     MOV      correctTime2(0x0D),A
    C:0x0942    C202     CLR      ready(0x20.2)
    C:0x0944    801B     SJMP     C:0961
    C:0x0946    150C     DEC      time3(0x0C)
    C:0x0948    750BFF   MOV      time2(0x0B),#CCU6_CC62RH(0xFF)
    C:0x094B    800D     SJMP     C:095A
    C:0x094D    850D0B   MOV      time2(0x0B),correctTime2(0x0D)
    C:0x0950    750AFF   MOV      time1(0x0A),#CCU6_CC62RH(0xFF)
    C:0x0953    750D00   MOV      correctTime2(0x0D),#0x00
    C:0x0956    8009     SJMP     C:0961
    C:0x0958    150B     DEC      time2(0x0B)
    C:0x095A    750AFF   MOV      time1(0x0A),#CCU6_CC62RH(0xFF)
    C:0x095D    8002     SJMP     C:0961
    C:0x095F    150A     DEC      time1(0x0A)
    C:0x0961    B2B6     CPL      P3_6(0xB0.6)
    C:0x0963    D0E0     POP      ACC(0xE0)
    C:0x0965    32       RETI 
        
                     TimerInit:
    C:0x0966    758922   MOV      TMOD(0x89),#0x22
    C:0x0969    758C96   MOV      TH0(0x8C),#0x96
    C:0x096C    758A96   MOV      TL0(0x8A),#0x96
    C:0x096F    758DB3   MOV      TH1(0x8D),#ID(0xB3)
    C:0x0972    758BB3   MOV      TL1(0x8B),#ID(0xB3)
    C:0x0975    E4       CLR      A
    C:0x0976    F5C1     MOV      T2MOD(0xC1),A
    C:0x0978    F5C0     MOV      T2CON(0xC0),A
    C:0x097A    75C3F7   MOV      RC2H(0xC3),#HWBPDR(0xF7)
    C:0x097D    75C5F7   MOV      T2H(0xC5),#HWBPDR(0xF7)
    C:0x0980    75C252   MOV      RC2L(0xC2),#0x52
    C:0x0983    75C452   MOV      T2L(0xC4),#0x52
    C:0x0986    43A82A   ORL      IEN0(0xA8),#0x2A
    C:0x0989    43B82A   ORL      IP(0xB8),#0x2A
    C:0x098C    75B9D5   MOV      IPH(0xB9),#0xD5
    C:0x098F    780E     MOV      R0,#stepsT0(0x0E)
    C:0x0991    7615     MOV      @R0,#0x15
    C:0x0993    08       INC      R0
    C:0x0994    7618     MOV      @R0,#0x18
    C:0x0996    22       RET 
         
                     CorrectTimes:
    C:0x0997    E50C     MOV      A,time3(0x0C)
    C:0x0999    7011     JNZ      C:09AC
    C:0x099B    E50A     MOV      A,time1(0x0A)
    C:0x099D    7004     JNZ      C:09A3
    C:0x099F    E50B     MOV      A,time2(0x0B)
    C:0x09A1    7003     JNZ      C:09A6
    C:0x09A3    150A     DEC      time1(0x0A)
    C:0x09A5    22       RET      
    C:0x09A6    E50A     MOV      A,time1(0x0A)
    C:0x09A8    7011     JNZ      C:09BB
    C:0x09AA    8007     SJMP     C:09B3
    C:0x09AC    850C0D   MOV      correctTime2(0x0D),time3(0x0C)
    C:0x09AF    E50A     MOV      A,time1(0x0A)
    C:0x09B1    7006     JNZ      C:09B9
    C:0x09B3    150B     DEC      time2(0x0B)
    C:0x09B5    750AFF   MOV      time1(0x0A),#CCU6_CC62RH(0xFF)
    C:0x09B8    22       RET      
    C:0x09B9    150A     DEC      time1(0x0A)
    C:0x09BB    22       RET
          
                     InterruptInit:
    C:0x09BC    75F808   MOV      IP1(0xF8),#counter(0x08)
    C:0x09BF    75F904   MOV      IPH1(0xF9),#0x04
    C:0x09C2    43B804   ORL      IP(0xB8),#0x04
    C:0x09C5    75B93B   MOV      IPH(0xB9),#0x3B
    C:0x09C8    75B764   MOV      EXICON0(0xB7),#0x64
    C:0x09CB    53A8FB   ANL      IEN0(0xA8),#CCU6_CC60RH(0xFB)
    C:0x09CE    43E804   ORL      IEN1(0xE8),#0x04
    C:0x09D1    43E808   ORL      IEN1(0xE8),#counter(0x08)
    C:0x09D4    D204     SETB     error(0x20.4)
    C:0x09D6    22       RET      
    
                     T0ISR:
    C:0x09F1    C0E0     PUSH     ACC(0xE0)
    C:0x09F3    C0D0     PUSH     PSW(0xD0)
    C:0x09F5    75D000   MOV      PSW(0xD0),#0x00
    C:0x09F8    C000     PUSH     0x00
    C:0x09FA    780E     MOV      R0,#stepsT0(0x0E)
    C:0x09FC    16       DEC      @R0
    C:0x09FD    E6       MOV      A,@R0
    C:0x09FE    7004     JNZ      C:0A04
    C:0x0A00    7615     MOV      @R0,#0x15
    C:0x0A02    1509     DEC      phase(0x09)
    C:0x0A04    D000     POP      0x00
    C:0x0A06    D0D0     POP      PSW(0xD0)
    C:0x0A08    D0E0     POP      ACC(0xE0)
    C:0x0A0A    32       RETI  
       
                     T1ISR:
    C:0x0A0B    C0E0     PUSH     ACC(0xE0)
    C:0x0A0D    C0D0     PUSH     PSW(0xD0)
    C:0x0A0F    75D000   MOV      PSW(0xD0),#0x00
    C:0x0A12    C000     PUSH     0x00
    C:0x0A14    780F     MOV      R0,#stepsT1(0x0F)
    C:0x0A16    16       DEC      @R0
    C:0x0A17    E6       MOV      A,@R0
    C:0x0A18    7004     JNZ      C:0A1E
    C:0x0A1A    7618     MOV      @R0,#0x18
    C:0x0A1C    1509     DEC      phase(0x09)
    C:0x0A1E    D000     POP      0x00
    C:0x0A20    D0D0     POP      PSW(0xD0)
    C:0x0A22    D0E0     POP      ACC(0xE0)
    C:0x0A24    32       RETI 
        
                     PortInit:
    C:0x0A25    75860B   MOV      P0_DIR(0x86),#time2(0x0B)
    C:0x0A28    E4       CLR      A
    C:0x0A29    F591     MOV      P1_DIR(0x91),A
    C:0x0A2B    F5B1     MOV      P3_DIR(0xB1),A
    C:0x0A2D    4391C0   ORL      P1_DIR(0x91),#T2CON(0xC0)
    C:0x0A30    438604   ORL      P0_DIR(0x86),#0x04
    C:0x0A33    22       RET
          
                     Shoot:
    C:0x0A34    300005   JNB      mainc(0x20.0),C:0A3C
    C:0x0A37    438001   ORL      P0_DATA(0x80),#0x01
    C:0x0A3A    8003     SJMP     C:0A3F
    C:0x0A3C    438002   ORL      P0_DATA(0x80),#0x02
    C:0x0A3F    D2C2     SETB     TR2(0xC0.2)
    C:0x0A41    22       RET  
        
                     ResetShoot:
    C:0x0A42    C2C2     CLR      TR2(0xC0.2)
    C:0x0A44    300004   JNB      mainc(0x20.0),C:0A4B
    C:0x0A47    5380FE   ANL      P0_DATA(0x80),#CCU6_CMPSTATL(0xFE)
    C:0x0A4A    22       RET      
    C:0x0A4B    5380FD   ANL      P0_DATA(0x80),#CCU6_CC61RH(0xFD)
    C:0x0A4E    22       RET      
    
                     TriggerISR:
    C:0x0800    C0E0     PUSH     ACC(0xE0)
    C:0x0802    C0D0     PUSH     PSW(0xD0)
    C:0x0804    75D000   MOV      PSW(0xD0),#0x00
    C:0x0807    C007     PUSH     0x07
    C:0x0809    E508     MOV      A,counter(0x08)
    C:0x080B    14       DEC      A
    C:0x080C    6012     JZ       C:0820
    C:0x080E    14       DEC      A
    C:0x080F    6022     JZ       C:0833
    C:0x0811    14       DEC      A
    C:0x0812    6024     JZ       C:0838
    C:0x0814    14       DEC      A
    C:0x0815    6026     JZ       C:083D
    C:0x0817    2404     ADD      A,#0x04
    C:0x0819    7048     JNZ      C:0863
    C:0x081B    85B00A   MOV      time1(0x0A),P3_DATA(0xB0)
    C:0x081E    8043     SJMP     C:0863
    C:0x0820    85B00B   MOV      time2(0x0B),P3_DATA(0xB0)
    C:0x0823    E50A     MOV      A,time1(0x0A)
    C:0x0825    D3       SETB     C
    C:0x0826    947F     SUBB     A,#0x7F
    C:0x0828    4039     JC       C:0863
    C:0x082A    300436   JNB      error(0x20.4),C:0863
    C:0x082D    C204     CLR      error(0x20.4)
    C:0x082F    1508     DEC      counter(0x08)
    C:0x0831    8030     SJMP     C:0863
    C:0x0833    85B00C   MOV      time3(0x0C),P3_DATA(0xB0)
    C:0x0836    802B     SJMP     C:0863
    C:0x0838    85B009   MOV      phase(0x09),P3_DATA(0xB0)
    C:0x083B    8026     SJMP     C:0863
    C:0x083D    AFB0     MOV      R7,P3_DATA(0xB0)
    C:0x083F    EF       MOV      A,R7
    C:0x0840    14       DEC      A
    C:0x0841    6010     JZ       C:0853
    C:0x0843    14       DEC      A
    C:0x0844    6013     JZ       C:0859
    C:0x0846    14       DEC      A
    C:0x0847    6016     JZ       C:085F
    C:0x0849    2403     ADD      A,#0x03
    C:0x084B    7016     JNZ      C:0863
    C:0x084D    C203     CLR      usePhase(0x20.3)
    C:0x084F    C200     CLR      mainc(0x20.0)
    C:0x0851    8010     SJMP     C:0863
    C:0x0853    D203     SETB     usePhase(0x20.3)
    C:0x0855    C200     CLR      mainc(0x20.0)
    C:0x0857    800A     SJMP     C:0863
    C:0x0859    C203     CLR      usePhase(0x20.3)
    C:0x085B    D200     SETB     mainc(0x20.0)
    C:0x085D    8004     SJMP     C:0863
    C:0x085F    D203     SETB     usePhase(0x20.3)
    C:0x0861    D200     SETB     mainc(0x20.0)
    C:0x0863    0508     INC      counter(0x08)
    C:0x0865    53B4F7   ANL      IRCON0(0xB4),#HWBPDR(0xF7)
    C:0x0868    D007     POP      0x07
    C:0x086A    D0D0     POP      PSW(0xD0)
    C:0x086C    D0E0     POP      ACC(0xE0)
    C:0x086E    32       RETI

  10. #20
    Super-Moderator Robotik Visionär Avatar von PicNick
    Registriert seit
    23.11.2004
    Ort
    Wien
    Beiträge
    6.842
    Die Gemeinde dankt recht schön.
    Ich hasse geheimnisvolle Dinge. Selbst wenn man irgendwie ein workaround findet, fange die Dinge meist dann wieder zu stinken an, wenn man ein komplexeres Programm drumherum aufgebaut hat. Und dann ist das Finden noch viel schwieriger.
    Ist auch reiner Egoismus, ich lern' mehr aus solchen forensischen Recherchen als aus 27 funktionierenden Programmen.
    Nur eine Frage noch: ist irgendein gefinkelter Überspruch von der 2^7 Leitung auf den Strobe-Pin möglich ?
    mfg robert
    Wer glaubt zu wissen, muß wissen, er glaubt.

Seite 2 von 4 ErsteErste 1234 LetzteLetzte

Benutzer, die dieses Thema gelesen haben: 0

Derzeit gibt es keine Benutzer zum Anzeigen.

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

Labornetzteil AliExpress