All my code projects compiles just fine with .bas INCLUDEs. So far.
Type: Posts; User: RossWaddell; Keyword(s):
All my code projects compiles just fine with .bas INCLUDEs. So far.
That's it! Thank you so much Richard. I've got both lines in my code but with comments as to which to use with which compiler.
I upgraded to PBP 3.1 recently and while some PIC code compiles just fine the following does not (although it compiles with PBP3 - I just switched my compiler to the old folder and it worked):
...
Thanks richard - that's what I suspected. The reason I wanted to move the ADC check to an IOC_INT was I had code in the Main loop to pulsate a LED which had PAUSEs in it which meant that you could...
I currently have a project which checks for changes on a trim pot as part of the main loop (the trim pot/ADC value then controls the brightness of a LED). It samples 16 readings and then sorts them...
In case anyone is interested in the final working code (using linearization correction):
' For production version of this code, comment out the line below re:
' LCD debugging and also update...
Ugh. Of course. Now it works perfectly, with a final PWM duty cycle of 511.
I expect something to show on the LCD, but it stays blank.
EDIT: I moved the LCD instructions to the loop to see what I could see and the final PWDuty value is 12291, way more than 512. The LED...
Tried this but it doesn't fade in the LED and I never get anything on the LCD screen after the counter to 100:
' For production version of this code, comment out the line below re:
' LCD...
Everything works just fine now. The last thing I need to do is introduce linearization correction to get a better, more linear fade in. I think the info in this thread should help.
Question: if...
Thanks Dave and tumbleweed! I've never had to use DIV32 before so I appreciate the explicit examples.
I grabbed this scaling function from an Arduino library and was emulating that:
' Arduino Map function to emulate:
' ===============================
' map(value, fromLow, fromHigh,...
Thanks again tumbleweed. I can't use PBPL without moving up to a 18F chip, and the minimum # of pins is then 18 (I only need two outputs so an 8-pin chip is ideal. Also, the PCB is pretty cramped now...
That explains it, thanks very much. When I do the math by hand the 255's cancel each other out and then it's just 412+100.
If I put brackets around the dividing part will that fix it?
Reset DataW to WORD variable (as it should have been all along) as well as the two ADC variables (since it's left-justified or 8-bit) but am still only getting a max value of 254 from the...
Thanks tumbleweed. I think I had that as a WORD earlier, but I will try it again today.
I'm trying to use 8-bit ADC to control the brightness of a LED via PWM. The goal is to have a smooth fade in to the brightness set by the trim pot so I eventually want to introduce linearization...
Could the 0.1uF cap across Vdd/GND have an effect here? I just swapped out the one on the breadboard for another and now the readings seem stable.
At 8-bit ADC it works much better; very little (if any) variation. Since I only need to adjust the brightness between 75-100% maybe 8-bit will be OK.
Switched to using a 16F1825 that was previously rock solid and it's still jumping around like crazy. Could it be this 5V switching voltage regulator? This code was what I used previously to test...
The 5V voltage regulator is a linear switching one from Pololu and the voltmeter output looks rock solid. It could be the pot, though - it's a sliding one from Sparkfun. i'll try with a traditional...
I removed the CCP stuff to leave just the ADC and still the value jumps around by +- 6 or more:
DEFINE OSC 16 ' Set oscillator 16Mhz
' For production version of this code,...
There's a PAUSEUS 50 there - isn't that sufficient?
Well, they were rock solid. Now the readings are varying quite a lot and even with Melanie's 'averaging' code to pick the middle 8 values from 16 it's still jumping around a lot (and still doesn't...
It's a 12F683. This forum won't let you edit a post after some time has passed so I couldn't update it.
Maybe what I could do is have 3 wires go up to the board - +5V, GND & +5V* (PWM control just...