you should use HPWM to produce the frequency, it's working smooth when your program jump here and there.
you should use HPWM to produce the frequency, it's working smooth when your program jump here and there.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi Lauren,
Do you still require assistance with your project ?
'mister e' is putting you on the right track. Try and use 'hardware' peripheral's
as much as you can to alleviate software latency issues. PBpro commands are great to get code off the ground quickly, but due to their inherent power, they generate quite a large amount of code to operate. Take a look at the 'asm' file, after compilation, and you will see what I mean.
meLAB's are a brilliant source for Microchip development stuff as you will see during your learning curve (none of us ever stop learning !).
Judging by the ADCON register configuration, it appears that you are using the internal A\D reference tied to the +5V logic rail and are most likely using the 'single turn' pot on the X1 board for your 0 - 5V signal. I imagine that there are two problems this project is suffereing from -
Circuit wise, there will be a lot of noise on the +5V rail and 'single turn' pot's are notoriously difficult to set with any accuracy.
Software wise, your code is looking for a 'literal' value (with the use of = and <>) in the 'IF_THEN' statements.
Bearing this in mind, the 'result register' only has to deviate by one least significant bit from the 'constant value' and the whole process will produce unexpected\unwanted results.
If you would like some sample code, please, DO NOT hesitate to ask.
Regards Mike B. Australia.
Hi Lauren,
Forgot to point out the following in my last post -
Have a look at your Freq\n loops and see if you can spot a problem.
Freq1:
HIGH 0
Pauseus 3600
LOW 0
Pauseus 3600
If A2D_VALUE <> %00001111 Then Loop 'This line is not working!
Goto Freq1
If your code is getting here, then this is where it will stay, as it has strayed away from the 'main' loop where the A\D conversion was taking place. The 'result' register can never change from %00001111, consequently, the IF_THEN statement can never fail which will cause the program to cycle endlessly within this loop.
A technique I use to check program flow is to turn on\off an LED to signal when my code enters\exits various program paths. Invaluable to show where I've 'goofed'
If you are not already using 'Microcode Studio Plus' with PBPro I urge you to get it. There are some very clever people in this world and Mechanique are no exception.
Hope this helps.
Regards Mike B.
Bookmarks