I've been trying allot of different approaches to my problem not wanting to give up and certainly not going to wait for someone to drop code in my lap. I came up with this routine that seems to be pretty stable.
This seems pretty stable so far and switching between the hair dryers hi and low settings I can clearly see the amps switch between 5.8 ish and 12.8 ish give or tak an ish he he he. I've got a call into a friend to see if he's got a real accurate amp meter that I can test and see how accurate this ACS754 is. I'll keep you posted.Code:mainloop: Gosub getx ' Get x value read ADC return value in 'x' x = x - 128 vmin = vmin min x ' Get min value WHILE VMIN <> 0 GOTO MAINLOOP 'stay here until the cross road of 0 WEND vmax = vmax max x resv = vmax * 3906 resv = div32 1000 READING = 1 VALUE = resv gosub average 'send calculated amps to darryl's average routine resv = value cnt = cnt + 1 if cnt >= 120 then 'get 120 averaged readings then display the amps Serout2 so,baud,[27,"[2;7H", dec5 resv] cnt = 0 'reset the counters and vmax = 0 VMIN = 1 endif Pause 10 ' Do it about 10 times a second Goto mainloop
If anyone else has any ideas about this code or possibly see something wrong with my code or has a better idea please let me know.
Thanks
David





Bookmarks