Page 1 of 1

porte on 18F4685

Posted: Sun Jun 27, 2010 11:34 am
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

Re: porte on 18F4685

Posted: Tue Jun 29, 2010 7:29 am
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.

Re: porte on 18F4685

Posted: Tue Jun 29, 2010 8:57 am
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;

Re: porte on 18F4685

Posted: Tue Jun 29, 2010 9:23 am
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;

Re: porte on 18F4685

Posted: Tue Jun 29, 2010 10:24 am
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

Re: porte on 18F4685

Posted: Tue Jun 29, 2010 12:05 pm
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.

Re: porte on 18F4685

Posted: Tue Jun 29, 2010 1:55 pm
by saschech@gmx.de
Hello Medelec35

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

Regards Wolfgang

Re: porte on 18F4685

Posted: Thu Jul 01, 2010 10:32 am
by saschech@gmx.de
Hello Steve

Is there a ather reason to initial porte?

Regards Wolfgang

Re: porte on 18F4685

Posted: Sat Jul 03, 2010 8:20 pm
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.