great idea i could test that, thanks a lot
thanks, all for your reply i´ll try
i am counting every objet that a limit switch detects, i have read that mechanical switches bounce everytime they are pressed, for a small period of time, every bounce could be read by the microcontrollers, so, to avoid that you can use a software debounce,
thanks for your reply, that is where i get stuck
thanks for your reply, could you give an example please for a counter?
i think i can store 50ms like this: #chip mega328p, 16 #include <millis.h> #define button portc.0 #define interval 50 ;50ms debounce #define usart_baud_rate 9600 #define usart_tx_blocking dim currentmillis as Word dim lastmillis as Word dim num as byte num=0 dir button in do currentmillis=millis() if currentmillis - lastmillis > interval then lastmillis=currentmillis end if loop
i think i can store 50ms like this: #chip mega328p, 16 #include <millis.h> #define button portc.0 #define interval 50 ;50ms #define usart_baud_rate 9600 #define usart_tx_blocking dim currentmillis as Word dim lastmillis as Word dim num as byte num=0 dir button in do currentmillis=millis() if currentmillis - lastmillis > interval then lastmillis=currentmillis end if loop
i think i can sotre 50ms like this: #chip mega328p, 16 #include <millis.h> #define button portc.0 #define interval 50 ;50ms #define usart_baud_rate 9600 #define usart_tx_blocking dim currentmillis as Word dim lastmillis as Word dim num as byte num=0 dir button in do currentmillis=millis() if currentmillis - lastmillis > interval then lastmillis=currentmillis end if loop
thanks for your reply, yes, i need to make sure that the button(limit switch) has been pressed (set ON)for 50 ms (time enoguh to avoid debounce) after that my microcontroller counts 1 object and repeat again(comes another object button is pressed, after 50ms another object is counted)
the mulstitask is for a conveyor that counts every object that touches a limit switch, conveyor doesn´t have sensor just switch, when the limit switch counts an object also activates a servo motor arm that pulls the object out of the conveyor into a box also when the servo is working a green light is blinking every 1 second, i was thinking working with the limit switch counter first .
thanks for your reply, i have read in documentation that "wait" "cause the program to wait for either a specified amount of time..." i think it is like "delay" in arduino, but the reason i started to use millis is that i couldn´t make a multitask program using delay , i think i will not be able to make a multitask program using "wait"
Hello Anobin, actually yes, i have used arduino with millis for debounce also ldmicro, i am not good at using interrupts or ticks, maybe some example with them i could give it a try
hello everybody, i am new in GCB (good software ) i would like to use debounce button with millis (30 ms debounce) , could you give some example or idea, thanks in advance
hello everybody, i am new in GCB (good software ) i would like to use debounce button with millis, could you give some example or idea, thanks in advance
hello where can i donwload millis library? it is no included in GCB donwload