be80be
Well-Known Member
The 4550 has a PLL.
The InternalOscillator.bas will not work with the 18f4550 and PLL
The can't set PLL on the Inosc. There a bunch of setting for the 18f4550 when you get into USB.
Last edited:
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.
The 4550 has a PLL.
//By BE80BE //
Device = 18F1320
Clock = 8 // 8MHz clock
Config OSC = INTIO2, WDT = OFF, LVP = OFF
Include "IntOSC8.bas"
Include "LCD.bas"
Include "utils.bas"
Include "convert.bas"
Dim IR_mod As PORTA.0 //pin the IR module on
Dim i As Byte
Dim IR_cmd As Byte
Dim loop As Byte
ADCON1=$70
// some LCD options...
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.2
#option LCD_EN = PORTB.3
Input (IR_mod)
SetAllDigital
IR_cmd = 0
While true
start:
While (IR_mod = 1) //loop while high
i = 0
Wend
While (IR_mod = 0) //loop while low
i = i + 1
DelayUS (200)
Wend
If i <= 10 GoTo start //if to short goto start
If i >= 14 GoTo start //if to long goto start
i = 0 // reset count
loop = 0
For loop = 0 To 6 //was 7 but thats too long need a 6 here for 7 loops LOL
IR_cmd = IR_cmd >>1 // this gets the 0 bits
While (IR_mod = 1)
i = 0
Wend
While (IR_mod = 0)
i = i + 1
DelayUS (200)
Wend
If (i >= 6) Then
IR_cmd = (IR_cmd Or $40) //this gets the 1 bits
End If
Next
Cls
LCD.Write("IR_cmd = ", BinToStr(IR_cmd))
DelayMS(250)
//leds = IR_cmd // this is just a test that outputs the binary
// value to leds on portb
Wend
IR_cmd = (IR_cmd Or $40) //this gets the 1 bits
The 4550 needs the USB to run at 96MHz and usually the CPU gets 48MHz (12MIPs)
Tell me what crystal you're using (USB won't work from the INTOSC) and I can tell you the PLL settings, it's actually a page in the datasheet with all possible crystal combinations.
Does the module check for out of spec frequencies. The max clock for the 4550 is 48MHz (12MIPs)