How do I configure GPIO mode in C?

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

cross mob
RaPe_287896
Level 1
Level 1
First like received

I am using the CY8C20234 CPU. Previously, I used assembly language to set Port 1 to STRONG with voltage to 2.4 VDC. The initial value was set in the PSOC Designer Pinout menu to 1.

or   F,           %00010000

or   REG[IO_CFG], %00110010

and  F,           %11101111

This works correctly, putting out 2.4VDC on pin 1_2.

I have tried this in C, but the voltage on this pin end's up being 0VDC.

asm("or  F,         %00010000");

asm("or  REG[0xDC], %00110010");

asm("and F,         %11101111");

I think it might have to do with the register address which I borrowed from the assembly project's hex output. Though either way I am sure there is a better way to do this in C. What is the best way to do accomplish this in C?

0 Likes
1 Solution
RaPe_287896
Level 1
Level 1
First like received

I figured it out.

IO_CFG |= 0b00110010;

View solution in original post

1 Reply
RaPe_287896
Level 1
Level 1
First like received

I figured it out.

IO_CFG |= 0b00110010;