Vasile,why do you ignore this library (I mean timer slots). After getting success with isr slots I tried to use interrupts and got huge fail. I can't get positive result whatever I do =(((((((((((( Does JAL has malfunctioned implementation for interrupts?
воскресенье, 10 апреля 2016 г., 12:57:47 UTC+3 пользователь vasile написал: > > Hi Anatoly, > > Pull-ups should be enabled or you need external resistors connected to VDD. > I never used delay slots in this way and perhaps I will never do. > I do not know any encoder library in jallib but I didn't used jal a long > time so perhaps exists. Maybe Rob knew better. > > Please take a look here: > https://beta.groups.yahoo.com/neo/groups/jallist/conversations/messages/140 > porting old jal (the code above) into jalV2 (the actual compiler) should > be piece of cake...:) > porting arduino sketches directly in jal is not recommended (you need > first to understand the jal philosophy), however arduino it's a good source > of inspiration! > > good wishes, > Vasile > > > > On Sun, Apr 10, 2016 at 11:34 AM, Anatoly Titov <[email protected] > <javascript:>> wrote: > >> Hello! I made a code adapted from Arduino sketch. Sketch works, my code >> nope =(((( Please tell, how to get working code without interrupts. >> http://www.hobbytronics.co.uk/arduino-tutorial6-rotary-encoder working >> sketch >> my code: >> >> -- target PICmicro >> include 12f683 >> pragma target CLOCK 4_000_000 >> pragma target OSC INTOSC_NOCLKOUT >> pragma target WDT disabled >> pragma target MCLR internal -- reset on pin A3 >> pragma target WDT DISABLED -- watchdog >> pragma target BROWNOUT DISABLED -- brownout reset >> pragma target FCMEN DISABLED -- clock monitoring >> pragma target IESO DISABLED -- int/ext osc. switch >> -- >> enable_digital_io() -- make all pins >> digital I/O >> --OPTION_REG_NGPPU = 0 -- pull-ups ON >> OSCCON_SCS = 0 -- select primary >> oscillator >> OSCCON_IRCF = 0b110 -- 4 MHz >> -- >> -- setting pins >> >> >> alias enc_b is pin_A5 >> pin_A5_direction = input >> >> >> alias enc_a is pin_A4 >> pin_A4_direction = input >> >> >> -- configure PWM >> pin_ccp1_direction = output >> include pwm_hardware >> pwm_max_resolution(1) >> pwm1_on() >> >> >> -- timer setup >> const TIMER0_ISR_RATE = 1000 -- 1 kHz isr rate >> const DELAY_SLOTS = 1 -- support slots >> include timer0_isr_interval >> timer0_isr_init() -- init timer0 isr >> >> >> --setting variables >> var byte pwm >> var bit old_a >> -- >> pwm = 0 >> pwm1_set_dutycycle_percent(pwm) >> >> >> forever loop >> >> >> if check_delay(0) then >> set_delay(0, 5) >> >> >> if old_a & !enc_a then >> if enc_b then >> if pwm!=254 then pwm = pwm + 1 end if >> else >> if pwm!=0 then pwm = pwm - 1 end if >> end if >> pwm1_set_dutycycle_percent(pwm) >> end if >> >> >> old_a = enc_a >> end if >> >> >> end loop >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jallib" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/jallib. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/jallib. For more options, visit https://groups.google.com/d/optout.
