futz
Active Member
LOL The story of my lifeLabRat said:... nothing happened.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
LOL The story of my lifeLabRat said:... nothing happened.
LabRat said:Will do. After I get home etc etc. It was just supposed to turn on the LED's, and I've probably missed something glaringly obvious. It was after all the first attempt. I was very pleased that the programmer recognized the 2550 and allowed me to program it (but not to put it in debug mode).
HDelay(45000);// Some useless inline comment
HDelay(8000);
HDelay(45000); // Some useless inline comment
HDelay(8000);
;HDelay(45000);// Some useless inline comment
For old timers like myself, wires that hook things together are preferable to chasing around the page for matching names.What made it "hard to read"
Whoo hoo!!blueroomelectronics said:Can you post the code?
/*
* Includes the generic processor header file. The correct processor is
* selected via the -p command-line option.
*/
#include <p18cxxx.h>
#include <timers.h>
#define NUMBER_OF_LEDS 2
void timer_isr (void);
static unsigned char s_count = 0;
/*
* For PIC18xxxx devices, the low interrupt vector is found at 000000018h.
* Change the default code section to the absolute code section named
* low_vector located at address 0x18.
*/
#pragma code low_vector=0x18
void low_interrupt (void)
{
/*
* Inline assembly that will jump to the ISR.
*/
_asm GOTO timer_isr _endasm
}
/*
* Returns the compiler to the default code section.
*/
#pragma code
/*
* Specifies the function timer_isr as a low-priority interrupt service
* routine. This is required in order for the compiler to generate a
* RETFIE instruction instead of a RETURN instruction for the timer_isr
* function.
*/
#pragma interruptlow timer_isr
/*
* Define the timer_isr function. Notice that it does not take any
* parameters, and does not return anything (as required by ISRs).
*/
void
timer_isr (void)
{
static unsigned char led_display = 0;
/*
* Clears the TMR0 interrupt flag to stop the program from processing the
* same interrupt multiple times.
*/
INTCONbits.TMR0IF = 0;
s_count = s_count % (NUMBER_OF_LEDS + 1);
led_display = (0x20 << s_count++);
/*
* Sets the special function register PORTB to the value of led_display.
*/
PORTC = led_display;
}
void
main (void)
{
/*
* Initialize the special function registers TRISB and PORTB.
*/
TRISC = 0;
PORTC = 0;
/*
* Enable the TMR0 interrupt, setting up the timer as an internal
* 16-bit clock.
*/
OpenTimer0 (TIMER_INT_ON & T0_SOURCE_INT & T0_16BIT);
/*
* Enable global interrupts.
*/
INTCONbits.GIE = 1;
while (1)
{
}
}
LabRat said:I'm looking at this thread where you had answered an almost identical question:
https://www.electro-tech-online.com/threads/junebug-pk2error0028.37774/
I will chase this for a bit, but as of 2 minutes ago the 1320 wasn't being recognized. Almost like I fried something somehow. Perhaps a good dose of leaving it alone for a night will fix things.
#include <p18F2550.h>
#include <timers.h>
#pragma CONFIG FOSC = HSPLL_HS, WDT = OFF, LVP = OFF
#pragma CONFIG PLLDIV = 5, CPUDIV = OSC1_PLL2
#define NUMBER_OF_LEDS 2
LabRat said:Thanks guys. I tried Bills program he posted in the other thread, to check on the crystals, and low-and-behold everything started working again. I suspect that I somehow messed up my oscillator settings, and I don't know enough yet, as to what to check etc. Having reprogrammed with "good settings" everything seems to be working again.
Three steps forward... two steps back.. three steps forward...
(time for bed)
Thanks again everyone. Have a good "what's left of your evening"