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

Need help with program 18F452

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







Need help with program 18F452
PostPosted: Tue Nov 05, 2002 6:06 am     Reply with quote

Hi,
I there anything wrong with this program, all I want to do is put a hight state (+5v) on port A & B on a 18F452..

And one more thing, has anyone have problem with programming
hexfiles with a "Universal Programmer", like Labtool-48, when I swap the bytes in the hexfiles the programmer programmes the config-bits correct but the program doesn't start, I have a nice OSC signal. I'm using PCH v3.114
--------------------------------------------------------------
#include <18F452.h>
#device *=16

#FUSES HS,NOWDT,NOPROTECT,PUT,BROWNOUT
#ID CHECKSUM
#ZERO_RAM
#use DELAY(CLOCK=7372800)
#use fast_io(A)
#use fast_io(B)
#BYTE PORTB = 0xF81
#BYTE PORTA = 0xF80

SET_TRIS_A(0);
SET_TRIS_B(0);
void main(void)
{
PORTA = 0xFF;
PORTB = 0xFF;
}
--------------------------------------------------------------

Best regards,
Robert
___________________________
This message was ported from CCS's old forum
Original Post ID: 8539
Hans Wedemeyer
Guest







Re: Need help with program 18F452
PostPosted: Tue Nov 05, 2002 10:08 am     Reply with quote

Put set_trisX() in the main()

#include <18F452.h>
#device *=16
#FUSES HS,NOWDT,NOPROTECT,PUT,BROWNOUT
#ID CHECKSUM
#ZERO_RAM
#use DELAY(CLOCK=7372800)
#use fast_io(A)
#use fast_io(B)
#BYTE PORTB = 0xF81
#BYTE PORTA = 0xF80

void main(void)
{
int i=0;

SET_TRIS_A(0);
SET_TRIS_B(0);
PORTA = 0xFF;
PORTB = 0xFF;

// just to allow you to see(with scope) what's happening
while(1)
{
PORTA = i;
i++;
delay_us(100);
PORTB = i;
delay_us(100);
}

}
:=--------------------------------------------------------------
:=
:=Best regards,
:=Robert
:=
:=
___________________________
This message was ported from CCS's old forum
Original Post ID: 8556
Ivar Johnsrud
Guest







Re: Need help with program 18F452
PostPosted: Tue Nov 05, 2002 11:55 am     Reply with quote

:=You would also need to set porta to digital:
:=
:=Put set_trisX() in the main()
:=
:=#include <18F452.h>
:=#device *=16
:=#FUSES HS,NOWDT,NOPROTECT,PUT,BROWNOUT
:=#ID CHECKSUM
:=#ZERO_RAM
:=#use DELAY(CLOCK=7372800)
:=#use fast_io(A)
:=#use fast_io(B)
:=#BYTE PORTB = 0xF81
:=#BYTE PORTA = 0xF80
:=
:=void main(void)
:={
:= int i=0;
:=
:= setup_adc(NO_ANALOGS);
:= SET_TRIS_A(0);
:= SET_TRIS_B(0);
:= PORTA = 0xFF;
:= PORTB = 0xFF;
:=
:= // just to allow you to see(with scope) what's happening
:= while(1)
:= {
:= PORTA = i;
:= i++;
:= delay_us(100);
:= PORTB = i;
:= delay_us(100);
:= }
:=
:=}
:=:=--------------------------------------------------------------
:=:=
:=:=Best regards,
:=:=Robert
:=:=
:=:=
___________________________
This message was ported from CCS's old forum
Original Post ID: 8565
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