what is the use of conditional address in ECNT?
what does mov32 instructions do?
can anyone please explain me about the above two instructions with a small example..
regards
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi
Thanks for posting your query, but this is the forum mainly for TMS570 microcontrollers.
TMS470 HET module and TMS570 NHET module are slightly different.
However the below explanations are applicable for both TMS470 HET and TMS570 NHET modules.
--> Conditional Address defines the address of the next instruction when the condition occurs.
ECNT instruction can be configured to use one of the Event conditions. If one of the conditions is true then the HET state machine will execute the instruction as specified in the Conditional Address.
--> MOV32 replaces the selected ALU register and/or the data field values at the remote address location depending on the move type.
Example code:
1) ECNT instruction can be used for Event Counter. The below example illustrates the use of cond_addr in ECNT instruction.
The goal is to count the number of rising edges received on PIN2 only when PIN0 is HIGH.
In the below HET code instruction 1(L00) executes every time but instruction 2 (L01) is executed only when the Event condition of instruction 1 occurs.
L00 ECNT{next=L00,control = OFF,prv = on,pin = 0,reg = B,event = ACCUHIGH,cond_addr =L01,irq=OFF,data =0}
;If (Event count condition is true) ( When Pin 0 is High)
;{
; register B = Immediate Data Field + 1;
; Immediate Data Field = Immediate Data Field + 1;
; Jump to Conditional Address ( L01);
;}
;else
; Jump to Next Program Address ( L00);
L01 ECNT{next=L00,control = OFF,prv = on,pin = 2,reg = A,event = RISE,cond_addr =L00,irq=OFF,data = 0}
;If (Event count condition is true) ( When Rise edge detected on Pin 2)
;{
; register A = Immediate Data Field + 1;
; Immediate Data Field = Immediate Data Field + 1;
; Jump to Conditional Address ( L00);
;}
;else
; Jump to Next Program Address ( L00);
2) Below example code generates PWM waveform with synchronous Duty Cycle Update using MOV32, ECMP and CNT instructions.
L00 CNT { next= L01, reg= A, irq= OFF, max= 4 }
; count: increment immediate data field (counter) of this instruction
; and write new value to reg_A
; if (counter == max)
; {set Z=1; reset immediate data field and reg_A to zero}
L01 ECMP { next= L00, cond_addr= L02, en_pin_action=ON, pin = 0, action= PULSEHI, reg= A, irq= OFF, data= 2, hr_data= 50h }
; if (reg_A == data_field) { set Pin 0; go to L02 }
; if ( Z==1 ) { clear Pin 0 }
; goto L00
L02 MOV32 { next= L00, remote= L01, type= imtoreg&rem, reg= A, data= 2, hr_data=10h }
; update duty cycle: write immediate data field of this instruction
; to the compare field of ECMP (L01) and to reg_A
For more information please refer TMS570 NHET Application note from the link
http://focus.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=spraba0
You can also find the windows based TMS570 NHET Simulator IDE from the link
http://focus.ti.com/docs/toolsw/folders/print/het_ide.html