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

PSoC™ 5, 3 & 1 Forum Discussions

Anonymous
Not applicable
        What all do I need to do to add UART to be able serial print a string? For example serial print ("Hello World"); So far I have added the Uart blocks to my chip and connected the TX to a output and rx to a input. I found a example and changed my Uart block setting to the same as the example. But no matter what I do I can get it to build without errors if I add any Uart code to the main.C Can anyone point me to a simple example of Uart that serial prints a string? Thanks.   
0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Well, PSoC1s are a bit more complicated, see the configuration ot the modules.

   

The timer is needed to generate the clock for 9600 baud for the UART. You get Tx and Rx at pins P0_0 and P0_1 resp. Voltage at those pins is not compatible with standard RS232 serial interfaces, those have a level of +- 12V which might destroy your PSoC chip. You would use a level translator like MAX232.

   

See attached project.

   

Bob

View solution in original post

0 Likes
16 Replies
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Are you using a PSOC 1 board if so I would recommend you update to a new chip as this chip is obsolete.  I would suggest the CY8CKIT-059 it is a PSoc 5 lp board and is only $5.00 US. Here is your program.

Anonymous
Not applicable

I will eventually figure out how to move this project to a newer chip. (Or have to pay someone to help me)

   

 

   

But for now all I need is a little Uart communication. That shouldn't be to hard right?

   

Bobgoar is that example PSoC1 or PSoC5?

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received
        Psoc 5 but you can change the device in the device selector to your Psoc 1 device.   
0 Likes

No, you can't. For PSoC1 you need PSoC Designer 5.4. And: PSoC1s are not obsolete.

   

 

   

Bob

0 Likes
Anonymous
Not applicable
        OK then dose anyone have a example for PSoC1 using designer 5.3 or 5.4? All I need it to do is serial print a string.   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Designer->File->Archive Project
and attach the resulting file.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

here is what I have its not much.

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

Well, PSoC1s are a bit more complicated, see the configuration ot the modules.

   

The timer is needed to generate the clock for 9600 baud for the UART. You get Tx and Rx at pins P0_0 and P0_1 resp. Voltage at those pins is not compatible with standard RS232 serial interfaces, those have a level of +- 12V which might destroy your PSoC chip. You would use a level translator like MAX232.

   

See attached project.

   

Bob

0 Likes
Anonymous
Not applicable

Awesome Bob Thanks so much!

   

Few questions,

   

1. can you explain how you set the speed? on my serial monitor 9600 did not work. 19200 worked.

   

2. can the timer be removed and use a internal clock? So that I am only using 2 user blocks for serial? 2 left for other things?

   

Thanks again.

0 Likes
Anonymous
Not applicable

Ok I think I figured out the speed.

   

19200 (The speed desired)

   

x8 (form datasheet)

   

153,600 (Needed clock speed)

   

24Mhz / 153,600 = 156

   

156 (Period on the timer)

   

 

   

Ok If thats correct and I want to change it to 9600 why wont it let me change the period parameter to anything over 255?

0 Likes
Anonymous
Not applicable

Also think i figured out how to remove the timer user block.

   

I set V3 up the same as the timer block and used that for my clock in. seams to work.

0 Likes
Anonymous
Not applicable

Check it out. works fine at 19200

   

Not sure how to get 9600 but the speed is not that critical to me, just trying to understand.

   

Thanks again.

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

Because it is an 8 bit timer. When you need to change the frequency you must find a combination of the input clock and the period of the timer.

   

If all this is experimental only, I would strongly recommend to use a PSoC4 or PSoC5 device. There are prototype kits and evaluation boards available for small money.

   

 

   

Bob

0 Likes
Anonymous
Not applicable
        For this project Im working on, Im using a open source file that is PSOC 1. All I want to do is add serial output to the project. I think I lack the knowledge to port this to PSoC 4 or 5. I'm so close to having what I need here. One more question and I think I will be done. UART_1_CPutString("1234");        //This serial prints 1234 How do I print a INT that changes? INT MyNumber; UART_1_CPutString(MyNumber);  //This creates errors in the build. What is the proper command to print a INT? Thanks   
0 Likes
Anonymous
Not applicable
        I figured out how to put the int into a string and print the string. Not sure that's the best way but it works and dose what I need it to do. Thanks for all the help.   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Generally speaking there are two ways to convert integers to string using C Language:

   
        
  • the macro itoa()
  •     
  • the function sprintf()
  •    
   

from which the latter is quite more flexible and accepts a format string for the wanted conversion.

   

 

   

Bob

0 Likes