PDA

View Full Version : Question about 18F4450



manwolf
- 8th July 2008, 02:55
I am trying out an 18F4450 on the LAB-X1 board.



'************************************************* ***************
'* Name : Hello.BAS *
'* Author : Ted Crafton *
'* Notice : Copyright (c) 2008 PROGRAM SPECS *
'* : All Rights Reserved *
'* Date : 6/10/2008 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
CLEAr
define LCD_DREG PORTD
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 1
DEFINE LCD_RWREG PORTE
DEFINE LCD_RWBIT 2
DEFINE LCD_BITS 8
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 20

TRISD=%00000000
TRISE=%00000000

ADCON1=%00000111

LOOP:
LCDOUT $FE,1
PAUSE 500
LCDOUT "HELLO"
pause 500
LCDOUT $FE,$C0
LCDOUT "Jan Crafton"
PAUSE 500
GOTO LOOP
END


If runs I have flashing LEDs, however the LCD only displays a row of blocks. I figure I either have bad fuses or some else real simple can someone point me in the right direction.

mackrackit
- 8th July 2008, 03:52
A row of blocks on the LCD might be the contrast needs adjusted. Pin #3 on the LCD.

More info would help.

Darrel Taylor
- 8th July 2008, 04:14
The 18F4550 has analog functions on PORT's A, B and E.

ADCON1=%00000111

Doesn't turn them all off.
<br>

manwolf
- 8th July 2008, 17:18
Darrel

Provided the right clue, I had overlooked one PORT. Reread the datasheet and discovered the error of my ways.

ADCON1 = %00001111 did the trick.

Thank you kind sir.

manwolf
- 9th July 2008, 02:05
Also overlooked the fact that I ordered the wrong PIC. I wanted a 18F4550 but ordered 18F4450 and then couldn't figure out why no I2C. 4550 has and 4450 does not.

If someone needs a couple of 18F4450 let me know.

Darrel Taylor
- 9th July 2008, 04:00
Don't give them away yet.

Did you know that the PBP I2C commands don't use the Hardware MSSP module?

You can still use I2CREAD and I2CWRITE.
<br>

manwolf
- 9th July 2008, 20:30
Darrel
No I didn't know that, I have been using the MSSP pins and figured that was the way it had to be.
The code I have written works on the 877A and 887 but not on the 4450. I am reading and writting to EEPROM.

I am currently using this to set the ports. (LAB-X1 board)

DataPin var PORTC.4
ClkPin var PORTC.3

I inserted the 4450 and programmed it, everything worked except the writting to EEPROM.

Guess I should have looked a little more closely at the datasheets. Pins changed in 4450, so no I2C on LAB-X1 Board.

877a - Pin18 - SCL - c3
Pin23 - SDA - c4

4450 - Pin18 - Vusb - Input
Pin23 - c4

Waiting for a few remaining parts to be able to start using Breadboard, then I can get off of the hardwired ports on the LAB-X1.

Thanks for your timely help there Darrel. :)

Darrel Taylor
- 10th July 2008, 00:59
> ... be able to start using Breadboard, then I can get off of the hardwired ports on the LAB-X1.

Ahhhh, freedom at last. :)

And, while I've never owned a LAB-X1 ... I think it's possible to cut the trace in-between the header rows, to isolate the pin from the peripherals. Then the peripherals can be wired to any other pin as needed.

I've seen it done before to allow using a 16F84 on the Lab-X1. (ICSP pins are different)

For RC3 its P2 pins 15-16, RC4 is P3 pins 15-16.

HTH,

manwolf
- 11th July 2008, 02:09
I have already 'wired' alot of stuff out to a breadboard. But I kind of like the little guy and don't want to start doing major surgery just yet. :o
Maybe next month :)

Now the EasyPic5 is a horse of a different color, I would do major surgery on it in a heartbeat.
I think it will end up in the parts bin before its over.

I have found the LAB board much easier to work with than the EasyPic. I think the switches adds more confusion to everything. My little pea brain can handle only having one chip in a socket at time.

I have a zif socket for the EasyPic and a few other ideas to make it more userfriedly for a future project.

Any suggestions for a power supply, I am currently using a 12v laptop powersupply and one of those cheap wall adapters from Radio Shack. The laptop supply is rated at 3 amps and appears to be clean enough for my projects so far.

Darrel Taylor
- 11th July 2008, 04:28
> and don't want to start doing major surgery just yet.

Probably a wise precaution.

> Any suggestions for a power supply

Could be a large number of answers to that question. And in the past I've used many different types. But these days, it's almost exclusively the little 5v "Switching" power supplies left over from dead routers, USB hubs etc that seem to only last about 3-5 years. The equipment dies, but the power supplies last forever.

Not all of them are switching, and not all are 5V. But the ones that are, work perfect for everything I've needed.

They have excelent isolation, fairly good regulation (4.8-5.2V), and usually a fairly high current output compared to a Transformer type "Wall Wart" that's twice the size.

Only rule is ... Measure the voltage and polarity BEFORE connecting to anything.

ErnieM
- 14th July 2008, 14:39
Also overlooked the fact that I ordered the wrong PIC. I wanted a 18F4550 but ordered 18F4450 and then couldn't figure out why no I2C. 4550 has and 4450 does not.

If someone needs a couple of 18F4450 let me know.

Funny you say that, I just completed a project where I made the same mistake in ordering the breadboard parts: got 4450 and thought I had 4550's.

Lead to some funny bugs because I was using a different compiler and there the target mattered (due to the differing ammount of RAM).

Also, both devices host the same MSSP Module, so hardware I2C is the same on both. (I'm sure of this because I wrote code to use it on the 4450 that recompiled & ran flawlessly once I got the correct 4550's.)

manwolf
- 14th July 2008, 22:47
Funny you say that, I just completed a project where I made the same mistake in ordering the breadboard parts: got 4450 and thought I had 4550's.

Lead to some funny bugs because I was using a different compiler and there the target mattered (due to the differing ammount of RAM).

Also, both devices host the same MSSP Module, so hardware I2C is the same on both. (I'm sure of this because I wrote code to use it on the 4450 that recompiled & ran flawlessly once I got the correct 4550's.)

ErnieM
My problem is that the LAB X1 is hard wired as to which pins are I2C, as Darrel pointed out the PBP commands work on any port.
But MicroChip says no MSSP on 4450.(from their site.)
0 -UART
1 -A/E/USART
0 -SPI
0 -I2C
0 -MSSP(SPI/I2C)

I am going to give the 4450 a shot and see what happens, I can always switch if it doesn't work out.

Thanks for the info, good to know in the future. :)

ErnieM
- 15th July 2008, 02:23
But MicroChip says no MSSP on 4450.(from their site.)

But they say yes to MSSP on page 1 of the data sheet.

ErnieM
- 18th July 2008, 20:55
Oops... not 4455... you said 4450.

Never mind.