Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problem with timer for create the delay

Status
Not open for further replies.

raja.afiq

Newbie level 3
Joined
Jul 17, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
20
i using pic18f4550. i made a coding as salve to run a servo motor. i try to make a delay using TMR0.
this is one of my code for delay
i define freq as 20Mhz
Code:
 void delay_tanda1 (void){   
 w=1850;   //i using this because w will be variable that come from master
 T0CON=0b01001000;   // 8bit timer, prescaler 1:64
 TMR0H = 256-((w*freq)/(256))   
 TMR0ON = 1;        // Turn On Timer0   
 while (TMR0IF==0);  // wait until overflow   
 TMR0ON = 0;         // Turn off timer 0   
 TMR0IF = 0;         // Reset timer0 flaq
 }
the problem is why the TMR0ON=1; in the coding have error: expression syntax. because i use the same coding for other program and it work. TMR0H in that program i use actual value in hexa.
 

thank.. it just because i left the ";" at the end of it. i did not notice that.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top