2005-10-24 05:18 PM
2005-10-19 12:29 PM
Hello!
I'm working with a ST72F324 MCU. I want to set a port like an output (PA4). When programming in C, I do the next: PADDR=0xFF; PAOR=0xFF; PADR=0xFF; and the led in this port is set, but when programming in asm, i do the next: BSET PADDR,#4 BSET PAOR,#4 BSET PADR,#4 I hope with this code, the led on PA4 would be set but it doesn't. Please, what is happening, I think i'm configuring correctly the I/O. Thanks.2005-10-19 09:17 PM
SSAM,
the ASM equivalent code of the C snippet is: LD A,#$FF LD PADDR,A LD PAOR,A LD PADR,A What you wrote is different, because it touches only the bit #4, instead of all pins. Are you sure that the led is attached to the right pin? EtaPhi2005-10-20 07:57 AM
Thanks a lot, EtaPhi
I have done the same you wrote, my main program do the next: .main call port_init loop jra loop .port_init LD A,#$FF LD PADDR,A LD PAOR,A LD PADR,A ret but running the program don't set the led in any PA port. When I use the similator it does'n set the PA ports anyway. The program is simple like this but i don't understand what is happenning. The ports are ok, because i probed them with the program in C. I tried doing with a bit instruction bset,#4, after configuring like an output pin, but it didn't work. I have to conect the MCU to a ST7538 and i need to generate REG_DATA AND RXTX signals from the MCU to the ST7538.The program i have is in assembler. Could be something wrong in my workspace configuration?2005-10-20 08:13 PM
It is very strange...
Since the C program code works, then the bug must lie in the asm source which is so simple... By the way, which hardware definition file do you include? I mean, the file which contains the definitions of HW ports i.e. PADR, PADDR and PAOR. Replace PADR with $00, PADDR with $01 and PAOR with $02 (these are the common addresses for Port A registers, but check your datasheet) and see what happens. You can also watch at the output of the C compiler. After that, I have no more hint... Bye EtaPhi2005-10-23 10:11 PM
You can generate a listing file (*.lst) by checking the option in the compiler. Then you can verify that the generated assembler code corresponds with yours.
Best regards Laurent2005-10-24 05:18 PM
Hello!!
The problem was solved. The only thing i did was download the new version of the ST7VD and taking the program to the root c:\. It is something i don't understand. Then with the ST7VD 3.1 the ports didn't work? Could someone explain to me what was the problem with the ST7VD and the ports? :( Thank you again. SSAM