On 03/09/2006, at 6:28 PM, Anand Dhuru wrote: > You have defined OSC 8; is the crystal actually 8? So my colleague assures me. I'm not using an external crystal - there's a default oscillator on the board, isn't there? (Again, forgive me my naivete, I'm new to this.) > If you dont define this (use the default 4 MHz) does the frequency > double? Yes - as I mentioned, either setting it to 4 or leaving the OSC declaration out gives 4 seconds per transition. > > Also, the LED would be on for 1 second, and off for 1; the cycle > would be 2 > seconds. True: I was imprecise. It's currently on for 8 and off for 8, with a cycle of 16. Mark > Regards, > > Anand > > ----- Original Message ----- > From: "Mark Wotton" > To: > Sent: Sunday, September 03, 2006 7:46 PM > Subject: [PIC] time-scaling problem with PIC 18F2455 > > >> Hello, >> >> I'm trying to program a PIC 18F2455 chip. I'm using PicBasic Pro as a >> frontend, MPLab v7.30 for the assembler, and MPLab icd 2 for the >> programmer. A simple testing program to flash a light on and off at 1 >> second intervals instead takes 8 seconds: >> >> ---------------------------------------- >> INCLUDE "modedefs.bas" >> >> define OSC 8 >> >> TRISA=%00000 >> TRISB=%00000000 >> TRISC=%11111111 >> >> StatusLED VAR porta.1 >> >> LOOP: >> high StatusLED >> pause 1000 >> low StatusLED >> pause 1000 >> goto LOOP >> ------------------------------------------ >> >> If I change OSC to 4 (or leave it out), the program takes 4 seconds >> per transition, so I initially thought I could just set OSC to 1 and >> be done with it - this wouldn't compile in PicBasic Pro, however, >> giving me the error "Symbol not previously defined (PAUSEUSL)". >> >> I tried fiddling with some of the constants defined in >> C:\pbp\p18f2455.inc, which the generated assembly included: >> -------------------------------------------- >> INCLUDE "P18F2455.INC" ; MPASM Header >> __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & >> _USBDIV_2_1L >> __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H >> __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H >> __CONFIG _CONFIG3H, _PBADEN_OFF_3H >> __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L >> --------------------------------------------- >> >> Unfortunately, nothing there seemed to have any effect on the timing >> at all. Where do you suggest I look next? I'm at a bit of a loss. >> >> (It's important that the timing be right for this, as I need to use >> serial comms to load new data at runtime, and SERIN doesn't seem to >> want to work, even when I tried setting the baud rate on the other >> end >> of the serial to 1200 to compensate.) >> >> Please let me know if I've missed describing anything important, I'm >> still quite new to PIC programming. >> >> Cheers, >> Mark >> >> -- >> A UNIX signature isn't a return address, it's the ASCII equivalent >> of a >> black velvet clown painting. It's a rectangle of carets surrounding a >> quote from a literary giant of weeniedom like Heinlein or Dr. Who. >> -- Chris Maeda >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> >> >> -- >> No virus found in this incoming message. >> Checked by AVG Free Edition. >> Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01- >> Sep-06 >> >> > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- I'm haunted by the freakish size of Nancy Reagan's head No way that thing came with her body. -- Mission of Burma, Nancy Reagan's Head -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist