ELEKTOR FORUMS

Please log in to post a reply or subscribe / unsubscribe to topics

Topic: 18F4455 I/O ports

Author Post

thorgal2610

3 posts

Popping In
Popping In

Read post 24-10-2010 20:22

When writing variations on the switch + led and the flashing led exercises I have noticed failures that I could not explain (I have Disabled the Low Voltage Program in the PICmicro Configuration so that is not the cause).

If I understand well than ports A to E can be configured to be input or output so to test my 18F4455 I have written a program that sets the ports A to E to be output then the ports are cycled 0b00000000 and 0b11111111 at a 200 msec interval. Then I have connected my led-board on all the ports, one port at a time. On port b led 5 never burns. On the other ports except for a few very faint flashes the led’s stay dark.

Can it be that I have destroyed the ports (leaving the 18F4455 processor intact) due to static and improper handling or is it not allowed to make ports other than b to be an output ?

GeenBert

64 posts

Frequent Visitor
Frequent Visitor

Read post 24-10-2010 23:06

Some pins are restricted and can only be used for a specific function (input, output or something completely different).

Ignoring that all ports can be made input, but some are more complicated than others. Port A and E are analog ports by default and need to be switched to digital before thay can be made to function as a digital input.

All ports can be made an output, but if you connect LEDs to them some will not flash because these are the pins with special functionality. Also note that port A only has six pins and port E only has three pins.

It is extremely unlikely that you've fried the ports of your PIC. The moste likely cause is that the PIC is not mounted securely into the socket. Eg. pins bent underneath the PIC, or pins not inserted all the way. Or that the LED board is not inserted all the way.

What was your result on assignment 3.a question 4?

thorgal2610

3 posts

Popping In
Popping In

Read post 27-10-2010 23:11

I used a prof. IC insertion tool, with a magnifying glass lamp I checked that all pins are proper inserted. The boards lie on a flat insulated surface, the LED board full inserted, no mechanical stress on the boards or the wires.

I used this code:

asm
{
	movlw 0b00000000
	movwf _trisc
	movlw 0b00000011
	movwf _portc
}


After compile to chip (no errors) the LED's connected to port C LED D0 & D1 burn.

But when I change the code to:

asm
{
	movlw 0b00000000
	movwf _trisc
	movlw 0b11111111
	movwf _portc
}


After compile to chip only the LED's D0, D1, D2, D6, D7 burn

Also when I change the code to:

asm
{
	movlw 0b00000000
	movwf _trisb
	movlw 0b11111111
	movwf _portb
}


All LED's burn except LED D5

Post edited by thorgal2610 on 27-10-2010 23:14

Post edited by thorgal2610 on 27-10-2010 23:15

Post edited by thorgal2610 on 27-10-2010 23:15

GeenBert

64 posts

Frequent Visitor
Frequent Visitor

Read post 29-10-2010 14:06

In your first message you suggested that most pins don't work as output. In this message you write that most pins do work as output but some don't.

That is exactly what I wrote: "All ports can be made an output, but if you connect LEDs to them some will not flash because these are the pins with special functionality".

You will learn later in the course that a4 needs a pull-up resistor, that b5 is used for debugging, that c3 doesn't exist and that c4 and c5 can be input only (in non-USB mode).

So rest assured that what you see is perfectly normal.

thorgal2610

3 posts

Popping In
Popping In

Read post 31-10-2010 12:42

Referring to assignment 3.f question 3 (what do you need to change in the program to make all 8 LEDs flash), I changed to code to:

// set all b output
movlw 0b00000000
movwf _trisb


When I implement the code B5 is not flashing. On page 564 is the fact that B5 is used for debugging is not mentioned. More, on page 564 figure 474 makes it more confusing.

Referring to my first mail (I should have included the code, so I will do now).

// configure as output
trisa = 0b00000000;
trisb = 0b00000000;
trisc = 0b00000000;
trisd = 0b00000000;
trise = 0b00000000;

porta = 0;
portb = 0;
portc = 0;
portd = 0;
porte = 0;

while (1)
{
	porta = 0b11111111;
	portb = 0b11111111;
	portc = 0b11111111;
	portd = 0b11111111;
	porte = 0b11111111;
	delay_ms(200);

	porta = 0b00000000;
	portb = 0b00000000;
	portc = 0b00000000;
	portd = 0b00000000;
	porte = 0b00000000;
	delay_ms(200);
};



If I use this code only the LEDs on port B with exception of B5 flash, all other ports stay dark. Is this the result of illegal code ?

But when I use:

asm
{
	movlw 0b00000000
	movwf _trisa
	movlw 0b11111111
	movwf _porta
}


Changing the code for ports A, B, C, D and E compiling etc ...

A6 and A7 stay dark, you explained why
B5 remains dark, you explained why
C3, C4 and C5 stay dark, you explained why
On port D all LEDs burn
On port E only E0, E1 and E2 burn, you explained why

So this seems to be normal, now I'm confused ...

JFinlayson

10 posts

Popping In
Popping In

Read post 11-12-2010 17:10

I am having problems with LED board on different ports as follows

Port A set as output and switch on port. no leds until power interupted or I place finger on J16, J17 then leds light for 3 to 6 seconds. this happens with all ports except B which comes on as expected.
Here is list of LEDS that don't work on ports

Port A D6 and D7 as expected no fault except requires above to start.

Port B Led D5 could be somthing to do with debugging but I am not convinced.

Port C D3 as expected but D4 and D5 also off, requires interup and only stays on fopr 3 secs

Port D all work except they need power interup and only stay active for 3 Seconds or so

Port E Led D3 does not work and this port requires the power interupt to start and only operates for 3 secs.

Also when I opened programmer bag there was loose transistor in bag on further examination this apears to have been attached on bottom of PSU jumper J29 somwhere.???

My conclusion is that my EB006-07 programmer is faulty

I have ried several 18F4455 chips as I have 10 or so in stock

Who do I contact for replacement programmer.

JohnF

JFinlayson

10 posts

Popping In
Popping In

Read post 11-12-2010 22:27

After much experimenting all above faults apear only when Low voltage program is enabled in expert screen chip config.
setting low voltage program to disabled alows all ports to behave as expected.
I am howevr confused why low voltage program enabled stops ports from working until power intrupted and then only works for a few sec, anyone now the answer??

Also setting bit7 on - on port E switches all port D on dimmly, they even flash in time with port e.??

I would like to know the answers for the above.

Also where this transistor came off on my board.

JohnF

JFinlayson

10 posts

Popping In
Popping In

Read post 11-12-2010 22:29

Ohh I forgot to add that low voltage program enabled disables bit5 on port B.

This is fun.

GeenBert

64 posts

Frequent Visitor
Frequent Visitor

Read post 15-12-2010 12:06

Many of the port/pin phenomena that you describe have been explained in my previous posts in this topic, perhaps you could check these for your reference.

Enabling low voltage programming (lvp) when this pin is not actually in use for this purpose increases the susceptibility to stray electric signals and may cause unexpected behavior. This is why the course instructions tell you to disable lvp. I strongly recommend you closely follow the instructions in the course, particularly if this is all new to you.

The only removable components on the programmerboard are the PIC, the jumpers and the crystal. If the transistor is indeed missing (compare the board with a picture in the book or on the web) then the board is faulty. Please contact the Elektor sales office for further instructions.

JFinlayson

10 posts

Popping In
Popping In

Read post 16-12-2010 14:33

Bert

The transistor has not come off component side of programmer board, and board apears to function OK, Is there any components on underside of board. I have EB-006-00-7.

No pictures of underside.

GeenBert

64 posts

Frequent Visitor
Frequent Visitor

Read post 16-12-2010 19:48

There are no components on the underside of the EB-006-00-7. Sounds like you're safe

PEPM1

5 posts

Popping In
Popping In

Read post 18-12-2010 11:47

GeenBert
You will learn later in the course that a4 needs a pull-up resistor


That's odd. When I have EB004 LED Eblock plugged in and set up to toggle port A4 every 500ms, LED connected to A4 flashes. Also with LED board unplugged, the voltage measured with DMM also changes from high to low/ low to high etc.
So this means either programming board has a pull-up resistor connected to A4 or A4 does not required a pull-up resistor?
So If LED on pin A4 is flashing, why is a pull up resistor required?
If you don't mind stating the page that refers this resistor then I can have a read, as I'm a bit confused.
Thank you.

Post edited by PEPM1 on 18-12-2010 11:48

GeenBert

64 posts

Frequent Visitor
Frequent Visitor

Read post 20-12-2010 10:21

PEPM1
So If LED on pin A4 is flashing, why is a pull up resistor required?


My mistake, sorry. A lot of PICs have A4 as open drain (pull-up required), but not the 18f4455 that is used in the course.

Please log in to post a reply or subscribe / unsubscribe to topics

Follow Elektor

      

Act now!

Bestseller

Microprocessor Design using Verilog HDL

This book is a practical guide to processor design in the real world. It presents the Verilog HDL in an easily digestible fashion and serves as a thorough introduction about reducing a computer architecture and instruction set to practice. 

Package Deals

Elektor Bundles

Check our Package Deals and save money! Discounts up to 19% now available!

Price Slashed

Elektor OSPV

This Open Source People Vehicle is perfect for factory halls, warehouses, hospitals, colleges, schools etc.

Elektor PCBs at 25% OFF