using internal DAC of a 16f1823

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

using internal DAC of a 16f1823

Post by Crenwick »

Hello,

In my new project I need to decode some bytes (with USART) and convert them to an anolog signal. I thought to use the 16f1823 because he has the USART and the DAC onboard.

But ! I'm unable to find how to use the DAC (located on RA0) with Flowcode...

Can someone give me an advice ?

Regards,

Bernard
Bernard

Flowcode 6 / EB006-V9

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: using internal DAC of a 16f1823

Post by Benj »

Hello Bernard,

Not sure if this will work but looks simple enough.

Pop this code in via a C icon to setup the DAC.

Code: Select all

daccon0 = 0xE0;
To shift down a 8-bit ADC reading to 5-bit you would do this in a calculation icon.

Code: Select all

adc = adc >> 3
Then to control the voltage on the output you would do this where you have a Flowcode byte variable called adc.

Code: Select all

daccon1 = FCV_ADC;
Let me know how you get on.

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: using internal DAC of a 16f1823

Post by Crenwick »

Hi Ben,

Just test compiled in Flowcode and seems to work !

Now just waiting after my Chip :wink:

Thanks !
Bernard

Flowcode 6 / EB006-V9

Post Reply