how to send a sinusoidal signal on lpc1788 gpio dac pin .

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to send a sinusoidal signal on lpc1788 gpio dac pin .

675 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by uttamraj09 on Tue Oct 07 10:20:19 MST 2014
hello everyone!

I am a newbie in embedded C programming .I want to send a sinusoidal signal on P0.26 pin, which is a dac gpio pin, and check it on an oscilloscope. For my hardware stuff, i have an olimex 4'3 board with LPC 1788 embedded on it. I am using the demo program provided by the olimex which can be found under https://www.olimex.com/Products/Modules/LCD/MOD-LCD4.3''/open-source-hardware .  I also got a sample dac sinewave code from lpcware cmsis code which was provided under http://www.lpcware.com/content/nxpfile/lpc177x-and-lpc178x-cmsis-compliant-standard-peripheral-firmw...  inside the example folder. Can anyone please give me some hints on how i can adapt the Dac_SineWave code from CMSIS library to my olimex demo program ?

thanks in advance ;)
Labels (1)
0 Kudos
1 Reply

453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Wed Oct 08 08:06:00 MST 2014
Hi uttamraj09,

To generate a sine wave with the DAC, you can go the route of taking an existing example or you make it from scratch. It's not hard at all you need is a timer interrupt, plus I think you'd learn more making it yourself :)

The DAC on the LPC1788 is a 10-bit DAC which means it has 2^10 or 1024 different voltage levels it can output. To generate a sine wave, all you need is something to periodically feed the DAC a new value, from 0 to 1024. This is where the timer interrrupt comes in to play. The frequency of the timer interrupt also allows you to easily change the frequency of the analog signal you are generating. To implement this, you would just need to learn how to set up a timer interrupt if the Olimex demo program does not have an example already, and how to interface with the DAC. In this case, the example code you found will be very helpful.

Regardless of which route you go, I think you should go through any relevant example (like the DAC one) and try to understand what is going on and why. The LPC1788 user's manual will be invaluable for you to understand the register interactions going on:

http://www.nxp.com/documents/user_manual/UM10470.pdf

If you have any specific questions please feel free to ask! Hope this helps :)
0 Kudos