porte on 18F4685

Moderator: Benj

Post Reply
saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

porte on 18F4685

Post by saschech@gmx.de »

Hello Team

In simulation the loop : porte 2:0 off > 10ms wait > porte 2:0 on > 10ms wait ... works ok.

after compile to chip dont work on hardware.

If i compile to chip the loop : porte 0 off > 10ms wait > porte 0 on >10ms wait > ... work ok

If i compile to chip the loop : porte 1 off > 10ms wait > porte 1 on >10ms wait > ... dont work

If i compile to chip the loop : porte 2 off > 10ms wait > porte 2 on >10ms wait > ... work ok

please help

regards wolfgang

User avatar
Steve
Matrix Staff
Posts: 3424
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: porte on 18F4685

Post by Steve »

This seems really strange. Could it be a problem with the hardware? If not, could the peripherals that are multiplexed with that pin be interfering with its output? It has these alternate functions: AN6 (ADC input), C1OUT (Comparator 1 output) and WR (PSP write enable input). The FCD seems to disable the ADC and Comparator appropriately. The PSP peripheral is controlled by bit 4 of TRISE - is this being set?

If you're still having problems, please replicate the problem in a very simple program and post the C code file here.

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: porte on 18F4685

Post by saschech@gmx.de »

Hello Steve

There is no hardware .
If i put in a macro with 0 > pe1,nothing work.

If i delete macro macro with 0 > pe1,
pe0 flash 10ms ok
pe1 i show on the scope f < 1µs
pe2 flash 10ms ok

//Initialisierung
adcon1 = 0x0F;
cmcon = 0x07;


//Interrupt-Initialisierungs-Kode



//Output
//Output: 0 -> E1
trise = trise & 0xfd;
if (0)
porte = (porte & 0xfd) | 0x02;
else
porte = porte & 0xfd;
Attachments
pe0 ok- pe1 nok - pe2 ok.c
(3.67 KiB) Downloaded 268 times
pe0_nok-pe1_nok-pe2_nok.c
(3.67 KiB) Downloaded 285 times

User avatar
Steve
Matrix Staff
Posts: 3424
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: porte on 18F4685

Post by Steve »

The C code files are identical.

Also, try putting the following in a C code icon at the beginning of the flowchart:

Code: Select all

trise = 0x00;

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: porte on 18F4685

Post by saschech@gmx.de »

Hello Steve

After i do these it dont work.
I put in the c-code on different position in the flowchart,no work

Regards Wolfgang
Attachments
testporte.c
(3.88 KiB) Downloaded 271 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: porte on 18F4685

Post by medelec35 »

Hello Wolfgang.

Did you paste the correct two C files?. Steve is right. I loaded your two files in a program which compares two files, and highlights any differences.

Only two differences are in lines of:
Name
&
Date. All others lines are 100% identical.
Martin

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: porte on 18F4685

Post by saschech@gmx.de »

Hello Medelec35

if i put in onetime "trise = 0x00" nothing work......

Regards Wolfgang

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: porte on 18F4685

Post by saschech@gmx.de »

Hello Steve

Is there a ather reason to initial porte?

Regards Wolfgang
Attachments
initial porte.gif
(89.66 KiB) Downloaded 1468 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: porte on 18F4685

Post by Benj »

Hello Wolfgang,

I have experienced some similar problems in the past and think it may be due to specific silicone problems with the chip or at least the specific silicone inthe chip you are using. I had I/O that simply would not behaive on some chips but worked well on others from a later batch. In the end I got around the problem by using a bit of C code like this.

set_bit(late, 1);
delay_ms(10);
clear_bit(late, 1);
delay_ms(10);

or like this

late = late | 0x02; //set bit 1 of port e
delay_ms(10);
late = late & 0xFD; //clear bit 1 of port e
delay_ms(10);

All this does is try to use the lat input for the register instead of the port register that the Flowcode I/O icons use.

Post Reply