Created Sat, 06 Oct 2018 18:31:27 +0000 by jabfg
Sat, 06 Oct 2018 18:31:27 +0000
Hello, I'm studying electrical engineering and this year and I'm doing a subject where I need to do a project using the Uno32 board. Looking in the internet, I found a PDF from microchip (http://ww1.microchip.com/downloads/en/DeviceDoc/61109G.pdf) where I saw that there was a way to output the CVREFOUT signal. So looking at this I had the idea of trying to create a simple and basic DAC using this signal. Looking to the uno32 pin-out, I found that, supposedly, the CVREFOUT is connected to the A3 port, but I have tried to mess with the CVRCON registry and I'm not having any luck in outputting this signal. So, I'm asking for help, since there is almost no information about this hidden functionality. Anyone can tell me the steps I need to do in order to output CVREFOUT? Thank you
Sat, 06 Oct 2018 20:58:48 +0000
The CVREF is something I have never played with. However it's pretty straight forward.
To get something out of CVREFOUT all you need to do is enable the output and turn on the peripheral.
Here's a little sketch that outputs a saw-tooth wave. It outputs about 0.2V peak.
void setup() {
CVRCONbits.CVROE = 1;
CVRCONbits.CVRR = 1;
CVRCONbits.ON = 1;
}
void loop() {
static uint8_t b = 0;
CVRCONbits.CVR = b & 0xf;
b++;
delay(1);
}
And a breakdown:
Sun, 07 Oct 2018 10:26:18 +0000
The CVREF is something I have never played with. However it's pretty straight forward. To get something out of CVREFOUT all you need to do is enable the output and turn on the peripheral. Here's a little sketch that outputs a saw-tooth wave. It outputs about 0.2V peak.
void setup() {
CVRCONbits.CVROE = 1;
CVRCONbits.CVRR = 1;
CVRCONbits.ON = 1;
}
void loop() {
static uint8_t b = 0;
CVRCONbits.CVR = b & 0xf;
b++;
delay(1);
}
And a breakdown:
Thank you for the answer but I continue to have the same problem that I had before, if I execute that code that you wrote, I obtain a DC signal of 2.2 Volt on the A3 port. Any idea why this happens and how to solve it? Thank you for the attention.
Sun, 07 Oct 2018 12:12:59 +0000
No idea. With that code I see a rather low-resolution sawtooth wave on my scope.
Sun, 07 Oct 2018 14:52:40 +0000
Thank you for the answer. Maybe my university's technician gave me a broken uno32. I will ask for another one and I will tested it. Just one more question, your board outputted the CVREFOUT only with the code that you wrote where? (you didn't needed to set more registries beside the CVRCON one, wright?) When I have a new one, I will post news.
Sun, 07 Oct 2018 15:51:22 +0000
That is a direct copy-and-paste of the code I am running.