Pin_c4 undefined in PIC18F2550 ?!?😳😳😳

24 views
Skip to first unread message

majid ebru

unread,
Jul 26, 2021, 2:27:57 AM7/26/21
to jallib
Hi to all

I use PIC18F2550.

When I complie I have error

[Error] (X-GLCD-10.jal) [Line 69] "pin_c4" not defined
[Error] (X-GLCD-10.jal) [Line 69] '=' expected (got 'pin_c4_direction')
[Error] (X-GLCD-10.jal) [Line 70] "pin_c4_direction" not defined
[Error] (X-GLCD-10.jal) [Line 70] unexpected token: pin_c4_direction

Pin_c4 undefined ?!!Why 😳😳😳🤣

Oliver Seitz

unread,
Jul 26, 2021, 3:01:30 AM7/26/21
to jal...@googlegroups.com
Hi Majid,

this time, you really spotted a device file error.

The chip has no pin_c3, but the device file does also not define the pins c4 and c5, which is indeed an error of the device file.

Until the device file is fixed, add these lines to your program:

--
var volatile bit    LATC_LATC4                at LATC : 4
var volatile bit    pin_C4                    at PORTC : 4
--
procedure pin_C4'put(bit in x at LATC : 4) is
   pragma inline
end procedure
--
var volatile bit    LATC_LATC5                at LATC : 5
var volatile bit    pin_C5                    at PORTC : 5
--
procedure pin_C5'put(bit in x at LATC : 5) is
   pragma inline
end procedure
--


Greets,
Kiste

Am Montag, 26. Juli 2021, 08:48:48 MESZ hat majid ebru <majid...@gmail.com> Folgendes geschrieben:
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/c16e1fb4-0547-48ef-9954-224bb58f8bf8n%40googlegroups.com.

majid ebru

unread,
Jul 26, 2021, 3:03:29 AM7/26/21
to jallib
Also
Pin_c5 not defined in PIC18F2550 ?!😳

Oliver Seitz

unread,
Jul 26, 2021, 3:06:34 AM7/26/21
to 'Oliver Seitz' via jallib
Sorry, my answer was not totally correct. Those pins are input only, the lat and the 'put parts are not available on that device. Also there's no direction for c4 and c5. Anyway, to be used as inputs, the pin_c4 and pin_c5 alias should be defined.

--
var volatile bit    pin_C4                    at PORTC : 4
--
var volatile bit    pin_C5                    at PORTC : 5
--

Greets,
Kiste





Am Montag, 26. Juli 2021, 09:01:31 MESZ hat 'Oliver Seitz' via jallib <jal...@googlegroups.com> Folgendes geschrieben:
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/1669519631.747340.1627282888545%40mail.yahoo.com.

majid ebru

unread,
Jul 26, 2021, 3:15:09 AM7/26/21
to jallib
Ok Kiste 
Now How can I set direction and use alias ?!

majid ebru

unread,
Jul 26, 2021, 3:18:05 AM7/26/21
to jallib
🤣😳

I use these pins for output ?!?

What can I do ?

I should change microcontroller type?!💙🙏

Oliver Seitz

unread,
Jul 26, 2021, 3:45:07 AM7/26/21
to jal...@googlegroups.com
Yes, if you need those locations as outputs, use a chip without USB module.

Greets,
Kiste




Am Montag, 26. Juli 2021, 09:25:24 MESZ hat majid ebru <majid...@gmail.com> Folgendes geschrieben:





🤣😳
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/996df6cd-c0e6-4b30-9a3a-668b72659117n%40googlegroups.com.

majid ebru

unread,
Jul 26, 2021, 4:15:09 AM7/26/21
to jallib
Please help me
At this time I can't change my controller,by means I can't buy new micro controller ?!?
🙏🙏🙏🙏🙏🙏🙏🙏

majid ebru

unread,
Jul 26, 2021, 5:16:34 AM7/26/21
to jallib
Yes

You said right

I download library PIC18F2550 from internet for Altium and I don't see carefully.

My lib is incorrect

Sorry and thank you

Rob CJ

unread,
Jul 26, 2021, 6:29:11 AM7/26/21
to 'Oliver Seitz' via jallib
Hi Oliver, Majid,

Thanks for the info. I will have a look at the Python script that generates the device files to see what is going on. I just  received a list of devices from Rob Hamerling for which the pins are missing (list below).

Once I fixed it  I will upload the device files so that they will be part of one of the bee packages.

Device files with PORT_RC4 but missing pin_C4
18f4450.jal
18f46j53.jal
18f2550.jal
18f4550.jal
18lf2450.jal
18lf2553.jal
18f2455.jal
18f4553.jal
18lf2455.jal
18lf4450.jal
18lf2550.jal
18lf4455.jal
18f4455.jal
18lf4550.jal
18lf4553.jal
18lf46j53.jal
18lf4458.jal
18lf27j53.jal
18f2553.jal
18f27j53.jal
18f26j53.jal
18f4458.jal
18lf47j53.jal
18f47j53.jal
18lf2458.jal
18lf26j53.jal
18f2450.jal
18f2458.jal
Device files missing pin_C4: 28

Kind regards,

Rob


Van: 'Oliver Seitz' via jallib <jal...@googlegroups.com>
Verzonden: maandag 26 juli 2021 09:06
Aan: 'Oliver Seitz' via jallib <jal...@googlegroups.com>
Onderwerp: Re: [jallib] Pin_c4 undefined in PIC18F2550 ?!?😳😳😳
 

Oliver Seitz

unread,
Jul 26, 2021, 6:31:56 AM7/26/21
to jal...@googlegroups.com
Well... The answer on how to do it is easy. You simply can not. It is impossible. The pins do not have output transistors. There is no way to use c4 or c5 as outputs.

If you can't use other pin locations or another type of controller, you have to solder wires to your board to be able to use other pins which do have output transistors.

There is no pin_c4_direction or pin_c5_direction because the hardware of those pins can not be outputs. 

See the attached bit of the datasheet. Pins c2 and c6 are called "Digital I/O". I/O stands for Input/Output. Pins c4 and c5 are called "Digital Input". That stands for Input and not Output.
 
Greets,
Kiste

Am Montag, 26. Juli 2021, 12:03:55 MESZ hat majid ebru <majid...@gmail.com> Folgendes geschrieben:
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jallib/e449d318-0f82-4d48-959c-e608e1033b27n%40googlegroups.com
.

18f2550pins.png

majid ebru

unread,
Jul 26, 2021, 7:06:56 AM7/26/21
to jallib
Thanks from all

Rob CJ

unread,
Jul 29, 2021, 3:16:05 PM7/29/21
to 'Oliver Seitz' via jallib
Hello Oliver, Majid,

I fixed the device files with the missing RC4 and RC5 input pins. Will be available in the next bee release.

Kind regards,

Rob


Van: jal...@googlegroups.com <jal...@googlegroups.com> namens Rob CJ <rob...@hotmail.com>
Verzonden: maandag 26 juli 2021 12:29

Oliver Seitz

unread,
Jul 29, 2021, 3:20:58 PM7/29/21
to jal...@googlegroups.com
Thanks! :-)

Greets,
Kiste




Am Donnerstag, 29. Juli 2021, 21:16:08 MESZ hat Rob CJ <rob...@hotmail.com> Folgendes geschrieben:
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/AM0PR07MB62411718300CF54CF589A643E6EB9%40AM0PR07MB6241.eurprd07.prod.outlook.com.

vsurducan

unread,
Jul 31, 2021, 8:37:06 AM7/31/21
to jal...@googlegroups.com
Hi Rob,
Perhaps those were missing because the basic use for RC4 and RC5 on those PICs is D+ and D- of the USB.
I guess you've did as recommended in datasheet to use them as inputs:
"To use pins, RC4 and RC5, as digital inputs, the USB module must be disabled (UCON<3> = 0) and the on-chip USB transceiver must be dis-abled (UCFG<3> = 1). The internal USB transceiver has a POR value of enabled."
On the other hand, C4 and C5 are only digital inputs even the pin diagram drawing shows them bidirectional just because of the USB...

best wishes,



Rob CJ

unread,
Jul 31, 2021, 10:55:22 AM7/31/21
to jal...@googlegroups.com
Hi Vasile,

For your information (and for anybody who is interested in this). 

The pins where missing in the device file since they could not be found in the XML file for those chips from Microchip.

This is a part of what is in that one of the XML files:
------
        <edc:SFRDef edc:_addr="0xF8B" edc:access="nnrr-nnn" edc:cname="LATC" edc:desc="" edc:impl="0xf7" edc:isindirect="false" edc:isvolatile="true" edc:mclr="uuuu-uuu" edc:name="LATC" edc:nzwidth="0x8" edc:por="xxxx-xxx">
          <edc:AliasList/>
          <edc:SFRModeList>
            <edc:SFRMode edc:id="DS.0">
              <edc:SFRFieldDef edc:cname="LATC0" edc:desc="" edc:mask="0x1" edc:name="LATC0" edc:nzwidth="0x1"/>
              <edc:SFRFieldDef edc:cname="LATC1" edc:desc="" edc:mask="0x1" edc:name="LATC1" edc:nzwidth="0x1"/>
              <edc:SFRFieldDef edc:cname="LATC2" edc:desc="" edc:mask="0x1" edc:name="LATC2" edc:nzwidth="0x1"/>
              <edc:AdjustPoint edc:offset="3"/>
              <edc:SFRFieldDef edc:cname="LATC6" edc:desc="" edc:mask="0x1" edc:name="LATC6" edc:nzwidth="0x1"/>
              <edc:SFRFieldDef edc:cname="LATC7" edc:desc="" edc:mask="0x1" edc:name="LATC7" edc:nzwidth="0x1"/>
            </edc:SFRMode>
----
As you can see the latch for pins C4 and C5 are not defined as pins since you cannot write to them. In the pic2jal.py script there was already a piece that handled other related exceptions by checking the values of 'edc:access' (the bold is not in the XML) in combination with PICs that do have a latch for those pins. As you can see there you see twice 'rr' which means read only (today I learned from Rob Hamerling that you have to read this from right to left to get the right order for the pins). 

So I extended the script with the check for these missing LATC pins with the' r' value and so they where added to the 28 samples that missed them as input only pins.

Kind regards,

Rob


Van: jal...@googlegroups.com <jal...@googlegroups.com> namens vsurducan <vsur...@gmail.com>
Verzonden: zaterdag 31 juli 2021 14:36
Aan: jal...@googlegroups.com <jal...@googlegroups.com>
Reply all
Reply to author
Forward
0 new messages