this is a bit of a silly one. I am trying to use the PIC10F222 to produce a modified sine wave and I want to have feedback from a current sensor to change the duty cycle (and so in turn the RMS).
I have ADCON0 set up properly because I am able to input a voltage to GP0 and have an effect on the duty cycle. The thing that is driving me crazy is I do not know what is being stored when ADRES is read(called?). I know that it is a string but how do I scale the string to be basically a number(integer) I can use in formulas.
I made this work with arduino by
/////////////////////////
sensorValue = analogRead(A4);
voltage = sensorValue * (5/1023);
/////////////////////////
This gives me a value that makes sense and is scaled from 0-5, I assume I should be able to do something similar with the PIC10F222? I have been trying different things and searching forums all day and nothing has proven helpful.
I have a pickit3 and for some reason even though it says it is a debugger I am unable to use it as a debug header so I can't see what my variables are in MPLABx which is what is really killing me because I feel as though I am just coding in the dark.
I know this is a bit vague so let me know if there is any clarification I can give.
I have ADCON0 set up properly because I am able to input a voltage to GP0 and have an effect on the duty cycle. The thing that is driving me crazy is I do not know what is being stored when ADRES is read(called?). I know that it is a string but how do I scale the string to be basically a number(integer) I can use in formulas.
I made this work with arduino by
/////////////////////////
sensorValue = analogRead(A4);
voltage = sensorValue * (5/1023);
/////////////////////////
This gives me a value that makes sense and is scaled from 0-5, I assume I should be able to do something similar with the PIC10F222? I have been trying different things and searching forums all day and nothing has proven helpful.
I have a pickit3 and for some reason even though it says it is a debugger I am unable to use it as a debug header so I can't see what my variables are in MPLABx which is what is really killing me because I feel as though I am just coding in the dark.
I know this is a bit vague so let me know if there is any clarification I can give.