CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

18C452 and PCH 3077 does input_d() work?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

18C452 and PCH 3077 does input_d() work?
PostPosted: Fri Mar 08, 2002 11:45 am     Reply with quote

<font face="Courier New" size=-1>I may have completely misunderstood the port d i/o
but looking at the assembler below input_d() reads the latch...
but the latch is the last value output from the PIC not the value at the port


#include <18C452.h>
#DEVICE *=16


#fuses HS,noWDT,NOPROTECT,NOPUT,NOBROWNOUT


#use delay(clock=20 000 000)


.................... #fuses HS,noWDT,NOPROTECT,NOPUT,NOBROWNOUT
....................
....................
.................... #use delay(clock=20 000 000)
....................
.................... main()
.................... {
.................... int data;
0004: CLRF FEA
0006: CLRF FE9
0008: CLRF FC1
.................... while(1)
.................... {
.................... data=input_d();
000A: MOVLW FF
000C: MOVWF F95
000E: MOVFF F8C,06
.................... }
0012: GOTO 000A
.................... } </font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 3067
Hans Wedemeyer
Guest







Re: 18C452 and PCH 3077 does input_d() work?
PostPosted: Sat Mar 09, 2002 11:54 am     Reply with quote

I just compiled your code using
#use fast_io(D) , if your program can handle the direct access
to port D it will be faster and more campact code.

.................... #device PIC18C452
.................... #list
....................
.................... #DEVICE *=16
....................
.................... #fuses HS,noWDT,NOPROTECT,NOPUT,NOBROWNOUT
.................... #use delay(clock=20 000 000)
.................... #use fast_io(D)
.................... main()
.................... {
.................... int data;
0004: CLRF FEA
0006: CLRF FE9
0008: CLRF FC1
....................
.................... data = 0;
000A: CLRF 06
....................
.................... while(1)
.................... {
.................... data=input_d();
000C: MOVFF F83,06
.................... }
0010: GOTO 000C
....................
.................... }
___________________________
This message was ported from CCS's old forum
Original Post ID: 3084
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

Re: 18C452 and PCH 3077 does input_d() work?
PostPosted: Sat Mar 09, 2002 5:06 pm     Reply with quote

Hans you must be using a different complier version than 3077
3077 gave me this.
F8c as you know is the latch so it could never if I have it right read the input at the port. The code you showed me with F83 the port would work but 3077 doesn't generate it.

CCS PCH C Compiler, Version 3.077

Filename: C:\PICC\PROJECT\WEBSRVR\TESTH.LST

ROM used: 10 (0\%)
Largest free fragment is 16374
RAM used: 6 (0\%) at main() level
6 (0\%) worst case
Stack: 0 locations

*
0000: GOTO 0004
.................... #include <18C452.h>
.................... //////// Standard Header file for the PIC18C452 device ////////////////
.................... #device PIC18C452
.................... #list
....................
.................... #DEVICE *=16
....................
....................
.................... #fuses HS,noWDT,NOPROTECT,NOPUT,NOBROWNOUT
....................
....................
.................... #use delay(clock=20 000 000)
....................
.................... #USE FAST_IO(d)
.................... main()
.................... {
.................... int data;
0004: CLRF FEA
0006: CLRF FE9
0008: CLRF FC1
....................
.................... while(1)
.................... {
.................... data=input_d();
000A: MOVFF F8C,06
.................... }
000E: GOTO 000A
.................... }
....................
0012: SLEEP
___________________________
This message was ported from CCS's old forum
Original Post ID: 3091
Hans Wedemeyer
Guest







Re: 18C452 and PCH 3077 does input_d() work?
PostPosted: Sat Mar 09, 2002 9:12 pm     Reply with quote

Your are bang on target.... I downloaded it but have not installed it yet... I just chekced I used 3.075 !
Sorry abotu that. Anyway that is interesting. I think you have just established a bug, you know of of those things that got broken when something else was fixed ! PCH has had it's share of them!
:=Hans you must be using a different complier version than 3077
:=3077 gave me this.
:=F8c as you know is the latch so it could never if I have it right read the input at the port.
The code you showed me with F83 the port would work but 3077 doesn't generate it.

If that will work for you. You can do it in assembly. Just copy paste from the lst..
Excuse me if you already know this...
Something like this

#byte _PortD_ = 0XF83 // some where in the header

int data;
while(1)
{
#asm MOVFF _PortD_,data #endasm
}

Hope this helps.

PS I'll not install 3.077 and wait for 3.078
PPS will you report this bug to CCS tech support? They don't always monitor the public board.
___________________________
This message was ported from CCS's old forum
Original Post ID: 3094
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

Re: 18C452 and PCH 3077 does input_d() work?
PostPosted: Sun Mar 10, 2002 8:49 am     Reply with quote

Thanks Hans ...you're a great help.
The bug is reported to CCS....
I'm new to the PIC18 assembler so I was looking for a confirmation since this bug is very severe in that it prevents all port input I thought it must be me (misunderstanding the assembler).
I did use an assembler patch like yours (actually yours is better) to get my code working.
PCH isn't perfect but I experienced a PCM to PCH conversion of several hundred lines resulting in 1 bug albeit a severe one. Approx 1 bug per thousand lines of code...and an almost instant 2 line fix for it (I could do myself in assembler) ...good work CCS!.. light years ahead of any microsoftie experience I have had (I now wait two years before installing a new softie OS to avoid the bugs and security wormholes).
___________________________
This message was ported from CCS's old forum
Original Post ID: 3107
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group