Information for Newbie

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
dbachman
Posts: 4
Joined: Thu Jun 26, 2008 1:39 pm
Location: Idaho

Information for Newbie

Post by dbachman » Thu Jul 10, 2008 1:40 am

Why does this only count to 10?

Device = 18F1320
Clock = 4
Config OSC = INTIO2, WDT = OFF, LVP = OFF
dim x as byte
OSCCON = $62 // 4MHz
Low(PORTA.6)
For x = 1 to 20
Toggle(PORTA.7)
DelayMS(250)
next
End

Thanks, Don

User avatar
Steven
BETA Tester
Posts: 406
Joined: Tue Oct 03, 2006 8:32 pm
Location: Cumbria, UK

Post by Steven » Thu Jul 10, 2008 6:18 am

Do you have an LED on PortA.7? If so, how many times does it flash?

Doj
Posts: 362
Joined: Wed Apr 11, 2007 10:18 pm
Location: East Sussex

Post by Doj » Thu Jul 10, 2008 10:35 am

I would have thought that if there is an led and it flashes 10 times(this is a guess as you have provided so little actual information) that the counter is going to 20, 10 on and 10 off.
If you use two consecutive toggle commands with a delay between each then it should flash 20 times as you may expect.

Also what is the low(porta.6) line doing?

Another issue could be the programmer not programing the fuses correctly and the watch dog still being on, however unlikely.

Indicating the method determining your assumption of only 10 counts would help lots!

Post Reply