Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Timing with no WAIT

Status
Not open for further replies.
Thanks Ian,

Looking forward to trying it tomorrow.

Now back to watching rockets on TV. (Error removed:oops:)

EDIT:1/ Changed the 'comma-space' to 'dot' and it compiled. See error gif
2/ Only when the TMR1H/L was placed before the IF, would it enter the numbers into the SFRs
3/ Is the TMR1 GIF relevant?

C.
 

Attachments

  • Error.gif
    Error.gif
    11.7 KB · Views: 251
  • TMR.gif
    TMR.gif
    47.7 KB · Views: 246
  • TMR1.gif
    TMR1.gif
    116.4 KB · Views: 247
Last edited:
Hi,

Here is the full program, that I want to add my PACE idea to. You will see there is some ASM for PWM at CCP1/2

In the TMR.GIF in post#21 you can see that nothing appears in the TMR1/2 SFRs also TIME does not increment. In the full program I have now changed the variable TIME to PACE.

C.
 

Attachments

  • 18F2431 AZ with PACE 161215 1400.txt
    7.6 KB · Views: 321
Hi Camerart!!

A couple of queries!! PORTA = 0x1C..

That gives INX, QEA and QEB an input..... BUT!! The two buttons are connected to PORTA 6 & 7.... AND PORTA.0 (AN0) is set up as an analogue input BUT you specify that PORTA 0 & 1 are connected to NFET's???
 
Hi Camerart!!

A couple of queries!! PORTA = 0x1C..

That gives INX, QEA and QEB an input..... BUT!! The two buttons are connected to PORTA 6 & 7.... AND PORTA.0 (AN0) is set up as an analogue input BUT you specify that PORTA 0 & 1 are connected to NFET's???

Hi Ian,

Well spotted, probably from a POT input test program.

PORTA should = 0xDC 110111000.
PORTA.0 should be digital

ADCON0 = %00000000 'A/D Control Register 0
ADCON1 = %00000000
ADCON2 = %10100001 'Not sure>>>>>>>>>>>>>
ADCON3 = %00000000
ADCHS = %00000000 'A/D Channels select
ANSEL0 = %00000000 'Analogue select Register 0
OSCCON = %01110010 'internal 8Mhz clock (Should bit0 be 1?)
TRISA = %11011100 'IN 7AF FOR BUTTON-6AR REV BUTTON-4QEA-3QEA -2IND
TRISB = %00000000 'OUT 4,LED
TRISC = %11000000 'IN 7RX-OUT-6TX-5#-4#-3#-2PWMFOR-1PWMREV

Hopefully these are now correct??

C.
 
Hi,

[I have re-named the title from INTERRUPT to WAIT, which is what I was looking for]

Thanks to Ian Rogers and others, I now have 2x TIMER (0 and 1) code, one of which I can use in my main program. Attached:

Camerart.
 

Attachments

  • 182431 INT 8Mhz TIMER0 LOOP TIMER 211215 0900.txt
    1.3 KB · Views: 234
  • 182431 INT 8Mhz TIMER1 LOOP TIMER 201215 1030.txt
    1.1 KB · Views: 272
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top