cancel
Showing results for 
Search instead for 
Did you mean: 

how to config port4 of upsd3354d?

wdcai
Associate II
Posted on March 11, 2005 at 08:38

how to config port4 of upsd3354d?

7 REPLIES 7
wdcai
Associate II
Posted on May 17, 2011 at 12:02

P4 port in uPSD33XX can work in 4 modes, capture,timer, toggle mode and PWM, only in timer mode(the clock of timer is from OSC), no any pins need to be configed as input or output, for example , in capture mode , input pins are needed, in toggle and pwm modes, outpout pins are needed, so I think all pins of P4 port may be configed as GPI/O when timer mode is working.

I have studied the datasheet In page 58,but I can't understand how to config potrt4 in timer mode while pins of port 4 are used as GPIO?

Can anybody give me some advice?

Thanks!

lwang
Associate II
Posted on May 17, 2011 at 12:02

I think Port 4 works as follow:

(1) Each of the 8-pins may be individually programmed as a GPIO pin, a PCA pin, or a Timer/Uart/SPI pin.

(2) To use one of these 8 pins as a GPO pin, you need to clear the corresponding bit in P4SFS0 (SFR 92h). Writing to the corresponding bit in P4 (SFR C0h) controls the voltage level at this GPO pin. See Data Sheet page 52, GPIO Output.

(3) To use one of these 8 pins as a GPI pin, you need to clear the corresponding bit in P4SFS0 (SFR 92h) and also write a “1� to the corresponding bit of P4 (SFR C0h). Reading the corresponding bit in P4 reflects the voltage level at this GPI pin. See Data Sheet page 53, GPIO Input.

(4) To use one of these 8 pins as a PCA pin, you need to set the corresponding bit in P4SFS0 (SFR 92h) and also clear the corresponding bit in P4SFS1 (SFR 93h). See Data Sheet page 60, Table-29. The exact function of this PCA pin is controlled by the PCA and detailed description can be found in the Data Sheet pages 121-130.

(5) To use one of these 8 pins as a Timer/Uart/SPI pin, you need to set the corresponding bit in P4SFS0 (SFR 92h) and also set the corresponding bit in P4SFS1 (SFR 93h). See Data Sheet page 60, Table-29. The function of this Timer/Uart/SPI pin is also indicated in the same table. -- Note that Port 1 can also be used for this and Port 1 has higher precedence.

[ This message was edited by: Lichen on 14-09-2004 05:42 ]
wdcai
Associate II
Posted on May 17, 2011 at 12:02

Thanks!

But I want to know whether all pins of port4 can be used as GPIO,and at the same time, two TCMs are configed as six soft timer!

lwang
Associate II
Posted on May 17, 2011 at 12:02

PCA and Port-4 are separate modules. Only when the desired PCA operation needs external input/output singles you need to route them from/to Port-4 pins. If TCMs are in timer mode and use internally generated clocks, you do not need any external input/output. Thus all Port-4 pins can be used as GPIO pins. But if PCA0 uses external clock input, then P4.3 must be routed to PCACLK0 and cannot be used as GPIO. Likewise, if PCA1 uses external clock input, P4.7 must be routed to PCACLK1. P4.0, P4.1, P4.2, P4.4, P4.5 and P4.6 can still be used as GPIO pins.

[ This message was edited by: Lichen on 14-09-2004 22:03 ]
lwang
Associate II
Posted on May 17, 2011 at 12:02

PCA and Port-4 are separate modules. Only when the desired PCA operation needs external input/output singles, you need to route them from/to Port-4 pins. If all the TCM are in timer mode and use internally generated clocks, you do not need any external input/output. Thus all Port-4 pins can be used as GPIO pins. But if PCA0 uses external clock input, then P4.3 must be routed to PCACLK0 and cannot be used as GPIO. Likewise, if PCA1 uses external clock input, P4.7 must be routed to PCACLK1. P4.0, P4.1, P4.2, P4.4, P4.5 and P4.6 can still be used as GPIO pins.

wdcai
Associate II
Posted on May 17, 2011 at 12:02

thanks for your clear explaination! I will try it when my PCB is finished!

luigi2
Associate II
Posted on May 17, 2011 at 12:02

I would use the Pin P4.0 for an input pin and i have configured mi PCA whit a internal clock generated by timer/overflow my register if set :

P4SFS0 |= 0x01;

P4SFS1 = 0x00;

but i d'ont read any signal in the port P4.0, IS the configuration correct? Help