cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

Anonymous
Not applicable

Hi All,

   

     I come from a PIC background and am just now starting to try and work with Cortex M3 and PSOC parts. I have been trying to figure out how to get the value of an 8 bit variable to 8 I/O pins. I read the post in "PSOC5 Architecture" titled "ADC output register to component pins", but it didn't go into depth enough for me to understand it (trigger an ISR??, use EMIF??).  Also I've seen plenty of examples of how to move one bit values to a port pin, but not how to move a byte wide value.

   

      Could someone please tell me what lines of code I would need in the following code snippet to send the ADC output value to physical pins on the part?

   

 

   

#include

       

 

   

<device.h>

   

void

   

{

 

ADC_DelSig_1_Start();

 

    main()    uint8    ADC_Out;    /* Start the ADC conversion */   

ADC_DelSig_1_StartConvert();

 

{

 

{

ADC_Out = ADC_DelSig_1_GetResult8();

 

    for    (;;)    if    (ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_RETURN_STATUS))    // What goes here to get value to port pins??   

 

 

}

}

 

}

   

/*  END OF FILE */

    

   

     I know this is probably really simple and that I'll be slapping myself in the forehead saying "DOH!!!" like Homer Simpson when I see how it's done, but right now I'm stuck!    :^)

   

     Thanks for any and all help!!

   

        EricM

0 Likes
Reply
4 Replies
JoMe_264151
Expert II

Welcome in the fascinating world of PSoCs!

   

There are several methods for sending an 8-bit value to port-pins, although this is "PIC-thinking" and not "PSoC thinking".

   

In PSoC world you usually use a communication interface to talk to another device, as you can see the parallel interface disapeared from the PC-world for a couple of reasons.

   

Using a control register module that is connected to the pins gives you the best control and even is capable of DMA which would free the CPU.

   

Getting the ADC-value and setting the control-register is the easiest way.

   

In the "System Reference Guide" (Help -> System Reference) you can get informations on how to set a complete port.

   

Ah, and by the way: The PSoC4 has got an ARM m0, not m3.

   

And: using the function "Create workspace Bundle" you can attach a complete project here, so that we all can have a look at.

   

 

   

Bob

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

This ap note discusses GPIO, creating logical ports out of pins, and writing

   

to them.

   

 

   

    

   

          

   

http://www.cypress.com/?rID=57571    AN72383

   

 

   

 Just as an aside you posted in PSOC 4 forum, but called out PSOC 5. If you

   

 

   

are intending to use PSOC 4 there is no DelSig in it, only a SAR. But you can

   

do the same with the SAR.

   

 

   

Lastly you can use DMA (with DMA wizard) to transfer this data in the background

   

w/o intervention. There are example projects in Craetor to do this.

   

 

   

Regards, Dana.

0 Likes
Reply
Anonymous
Not applicable

    Thanks Bob and Dana for getting back to me so quickly. I was aware of the fact I'm mixing PSOC4 and PSOC5 parts in my original post. This was just a quickly thrown together test since I'm just starting. Initially I started the project based on the PSOC5 and I'm now moving it to the PSOC4 since I just got a Pioneer board to play with.

   

    Although most of the reference material you both mentioned only seems to talk about single pin I/O, the approach of using a register seems to work. Clearly though, I have a LOT to learn.

   

      Thanks again for your help!!!

   

 

   

       EricM

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

Eric, the ap note I posted specifically has logical port creation

   

of width you choose, and APIs / register declarations to write to it.

   

 

   

Regards, Dana.

0 Likes
Reply