Switching GPIO pin between UART(v2.5) and XXX_Write(Bolean);

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

I am creating a dmx transmitter. Iam creating a break on a pin with the XXX_Write(Bolean); command and it works find. After the break it goes high to a MAB and i want to swith the output from digital write with a command to the UART so the UART can send the DMX data.

While writing the digital pin high and low with the Hardware Connection connected to the pin it goes low but in a curve. When turning the pin on and off it should become a square but the falling edge isn't straight down.

How can i do this?

I was thinking of turning on and off the Hardware Connection of my pin when iam commanding the break and turning it on when the UART is going to send data, but i can't find a register or something that can turn it on and off mid program. (short said connect and disconnect it from the UART block)

Thank you!

ps: i have the CyCKIT-044 PSoC 4 M-series pioneer kit with a PSoC 4200M device

0 Likes
1 Solution
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

The register "CYREG_PRT1_DR" is a port output register for the Port1.  The register detail is described at the section "16.1.10 GPIO_PRT1_DR" in the "PSoC 4200M Family PSoC 4 Registers TRM"  This document can be downloaded from following page.

PSoC 4100M/4200M Family: PSoC® 4 Registers Technical Reference Manual (TRM) | Cypress Semiconductor

This register value is used for the eight bit data output of Port1[7:0]

reg=CY_GET_REG32(CYREG_PRT1_DR);

CY_SET_REG32(CYREG_PRT1_DR,reg|0x01);//SFB

CY_SET_REG32(CYREG_PRT1_DR,reg&0xFFFE);

CY_SET_REG32(CYREG_PRT1_DR,reg|1);//SFB

In step#01 the status of the register is stored in the variable reg

In step#02 the status value which bit-0 is set is stored to the register.  The P1[0] is set to HIGH.

In step#03 the status value which bit-0 is cleared is stored to the register.  The P1[0] is set to LOW.

In step#04 The P1[0] is set to HIGH as well as the step#02

So what the four lines are doing is to make a short negative pulse at the P1[0] pin.

Regards,

Noriaki

View solution in original post

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Easiest would be to use a simple Mux between your UART and the Tx pin. Using a control register you will be able to switch the signal path and set the Tx output to your needs.

Bob

0 Likes
Anonymous
Not applicable

No i have to do it through a register.

I got this example code from a co-worker but i need to know what the 4 register lines mean

   

reg=CY_GET_REG32(CYREG_PRT1_DR);

   CY_SET_REG32(CYREG_PRT1_DR,reg|0x01);//SFB
  
  CY_SET_REG32(CYREG_PRT1_DR,reg&0xFFFE);
   CY_SET_REG32(CYREG_PRT1_DR,reg|1);//SFB
  
  
  
  
  
  
  
0 Likes
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

The register "CYREG_PRT1_DR" is a port output register for the Port1.  The register detail is described at the section "16.1.10 GPIO_PRT1_DR" in the "PSoC 4200M Family PSoC 4 Registers TRM"  This document can be downloaded from following page.

PSoC 4100M/4200M Family: PSoC® 4 Registers Technical Reference Manual (TRM) | Cypress Semiconductor

This register value is used for the eight bit data output of Port1[7:0]

reg=CY_GET_REG32(CYREG_PRT1_DR);

CY_SET_REG32(CYREG_PRT1_DR,reg|0x01);//SFB

CY_SET_REG32(CYREG_PRT1_DR,reg&0xFFFE);

CY_SET_REG32(CYREG_PRT1_DR,reg|1);//SFB

In step#01 the status of the register is stored in the variable reg

In step#02 the status value which bit-0 is set is stored to the register.  The P1[0] is set to HIGH.

In step#03 the status value which bit-0 is cleared is stored to the register.  The P1[0] is set to LOW.

In step#04 The P1[0] is set to HIGH as well as the step#02

So what the four lines are doing is to make a short negative pulse at the P1[0] pin.

Regards,

Noriaki

0 Likes