Thanks Vaclav, silly me, the pin was shorted.
I violated the three laws of development work: Assume nothing, Believe nothing, Check everything, or ABC for short! Because the PCB was unpopulated except for the PIC and XTAL and bypasses, I assumed that there would be no shorts and failed to check it and believed that this was a sw issue (being a programmer!). There was actually a very very tiny copper blop between a trace and gnd. I barely saw it, but scrapring with a knife tip removed the short. Sorry for the wasted band width and thanks to Fabien also. br Kusti >>> vacla...@seznam.cz 11.1.2009 18:39 >>> Hi Kusti, are you sure that you have proper connection of wires to that pin ? And pin is not shorted to anything else? AFAIK PORTD2 bit has no other functionality to 1 and 0 bits. If you remove anything else and make simplest code ( just Z = 0, delay(); Z= 1; delay() )- it does not work, too ? Vaclav > ---------------------------------------- > Hi, > > this is not the right list, I know, but at very least I hope someone > will direct me to a list likely to produce some insight to my problem. > > I using PIC18F4550 and so far I've got remarkable little problems. > > However I've not been able to control the bit 2 of PORT D. > > I'm observing the direct outputs from the MCU pin with oscilloscope. > > I've looked at the code produced by SDCC and it makes perfect sence. > > So I'm thinking this is something to do with some PIC18 configuration > or > some registers not being set up properly. > > I've been up and down the datasheet but have not found anything > that would get me further. > > My code is as follows: > > #define STEP_X PORTDbits.RD0 > #define STEP_X_TRIS TRISDbits.TRISD0 > > #define STEP_Y PORTDbits.RD1 > #define STEP_Y_TRIS TRISDbits.TRISD1 > > #define STEP_Z PORTDbits.RD2 > #define STEP_Z_TRIS TRISDbits.TRISD2 > > <snip> > > STEP_X_TRIS = 0; > STEP_Y_TRIS = 0; > STEP_Z_TRIS = 0; > <snip> > > for (;;) { > STEP_X = 0; > STEP_Y = 0; > STEP_Z = 0; > LED_PIN = 0; > delay_ms(2); > > STEP_X = 1; > STEP_Y = 1; > STEP_Z = 1; > > LED_PIN = 1; > delay_ms(2); > > } > > br Kusti > > > > ------------------------------------------------------------------------------ > Check out the new SourceForge.net Marketplace. > It is the best place to buy or sell services for > just about anything Open Source. > http://p.sf.net/sfu/Xq1LFB > _______________________________________________ > Sdcc-user mailing list > Sdcc-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > > ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user