Thank you very much Tony.
That helped alot, now SERIN and SEROUT are working.
Now i trying to figure out how to make RA5 to digital input/output.
Thank you very much Tony.
That helped alot, now SERIN and SEROUT are working.
Now i trying to figure out how to make RA5 to digital input/output.
Look in the Analog to digital section... maybe in the comparator section (if there's any)
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Yepp i find it
sets all AN pins to Digital I/O.Code:ADCON1 = %000001111
See "REGISTER 21-2: ADCON1: A/D CONTROL REGISTER 1" in the datasheet for 18F2550
Thank you...
Sorry to drag up an old thread but i am struggling to get my head around these registers. I am moving over from using a 16F876A chip and at the moment i cant get the LCD to operate correctly. The characters are displaying but every few cycles they seem to get confused with some noise and random characters appear. Could this be anything to do with having not set the oscillator in the code for my external 4Mhz (I looked for this code but couldn't see any need for it)?
Thanks for any help!
Code:'BO = LCD INTERFACE'B1 = LCD INTERFACE 'B2 = LCD INTERFACE 'B3 = LCD INTERFACE 'B4 = LCD INTERFACE 'B5 = LCD INTERFACE 'B6 = LCD INTERFACE 'B7 = LCD INTERFACE ' 'C0 = SERVO 1 'C1 = SERVO 2 'C2 = 'C3 = 'C4 = 'C5 = 'C6 = 'C7 = '*********************************************************************** '****************** DEFINE ADCIN PARAMETERS***************************** '*********************************************************************** pause 1000 asm __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H __CONFIG _CONFIG3H, _PBADEN_OFF_3H __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L & 0DFh endasm DEFINE LCD_DREG PORTB 'Define PIC port used for LCD Data lines DEFINE LCD_DBIT 4 'Define first pin of portb connected to LCD DB4 DEFINE LCD_RSREG PORTB 'Define PIC port used for RS line of LCD DEFINE LCD_RSBIT 3 'Define Portb pin used for RS connection DEFINE LCD_EREG PORTB 'Define PIC prot used for E line of LCD DEFINE LCD_EBIT 0 'Define PortB pin used for E connection DEFINE LCD_BITS 4 'Define the 4 bit communication mode to LCD DEFINE LCD_LINES 2 'Define using a 2 line LCD DEFINE LCD_COMMANDUS 2000 'Define delay between sending LCD commands DEFINE LCD_DATAUS 50 'Define delay time between data sent. main: LCDOUT $FE, 1 pause 10 LCDOUT $FE, 2 pause 10 LCDOUT "3 axis track V1" pause 5000 goto main END
I'd try this:
DEFINE OSC 4
Robert
EDIT: This chip (like probably most PICs), has built-in oscillator. Any reason why you don't want to use that?
And double-check the configuration fuses for the oscillator.
Last edited by Demon; - 8th January 2012 at 02:18.
Thanks, I shall try that when I am at home tomorrow evening!
Only the fact that I was always shown circuits with external ones! Are there many benifits to using the internal ones?
With the fuses what kind of thing am I looking for or do you know of a beginners guide, as I haven't really dealt with those bits yet!
Thanks!
Fewer parts, lower cost, less chance of solder problems, less space required on PCB, saving the planet, the list goes on.I've been using external oscillatorsmainly 'cause I bought a bag and enough capacitors, but that might change with USB.
The datasheet is your friend:
http://ww1.microchip.com/downloads/e...Doc/39632e.pdf
Page 32, section 2-3:
When these devices are used for USB connectivity,
they must have either a 6 MHz or 48 MHz clock for
USB operation, depending on whether Low-Speed or
Full-Speed mode is being used. This may require some
forethought in selecting an oscillator frequency and
programming the device.
The full range of possible oscillator configurations
compatible with USB operation is shown in Table 2-3.
I just pulled out a 18F4550 about 10 minutes ago to get back into USB programming. We share the same datasheet, but I can't comment on config yet, I have to search the forum for examples first. (Here's an interesting thread to start with)
http://www.picbasic.co.uk/forum/show...18f4550+config
Robert
EDIT: But then it says this under the table:
Since several of my PCs don't have USB 2.0, I'll be targetting low speed.Legend: All clock frequencies, except 24 MHz, are exclusively associated with full-speed USB operation (USB clock of 48 MHz).
Bold is used to highlight clock selections that are compatible with low-speed USB operation (system clock of 24 MHz,
USB clock of 6 MHz).
Oh yes, don't forget that new PCs have USB 3.0, you'll have to look at an expert here to know how to handle that.
Last edited by Demon; - 10th January 2012 at 03:59.
Hi demon, I haven't had a chance to gt on the pc to try this yet but what would be the difference between using:
DEFINE OSC 4
And
Code:
@ __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
Is the define a pbp level code and the config I'm guessing in asm level?
I'm not looking at USB yet but I may well try it in future projects!
I had a look at the data sheet before posting but got very confused and gave in to google which didn't help much either
I think I may well look to moving to onboard especially if USB will drive off this too!
Thanks again!
Last edited by chrisshortys; - 13th January 2012 at 17:45.
I'm on cellphone, so sorry for short reply...
Datasheet says USB requires external oscillator.
Bookmarks