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 CCS Technical Support

PROBLEMS CCS 3.224
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 17, 2005 12:33 pm     Reply with quote

In Section 18.0 of the 18F4525 data sheet, on the upper right side
of the page, it says:
Quote:
The pins of the Enhanced USART are multiplexed
with PORTC. In order to configure RC6/TX/CK and
RC7/RX/DT as a USART:
• bit SPEN (RCSTA<7>) must be set (= 1)
• bit TRISC<7> must be set (= 1)
• bit TRISC<6> must be set (= 1)

What is in your code ? This line:
Quote:
set_tris_c(0x00);


Whenever you use a PIC module, you must read the data sheet
section on that module.
Tony
Guest







problems CCS 3.224 OR EUSART PIC18F4525?
PostPosted: Wed May 18, 2005 3:33 am     Reply with quote

Before i'm writing you ,
I have tried "set_tris_c(0xC0);" but the thing is not change!
The code DOESN'T WORK WITH 18F4525!

Could you you please try the code below?
Thanks
Tony


#include <18f4525.h>
//#include <18f452.h>

#FUSES HS, NOPROTECT, NOPUT, NOBROWNOUT, NOWDT, NOLVP
#ZERO_RAM

#byte TXREG= 0xFAD
#byte RCREG= 0xFAE
#byte SPBRG= 0xFAF
#byte SPBRGH= 0xFB0
#byte BAUDCON = 0xFB8
#byte RCSTA = 0xFAB
#byte TXSTA = 0xFAC
#byte PIE1 = 0xF9D

#bit BRG16 = BAUDCON.3
#bit BRGH = TXSTA.2
#bit SYNC = TXSTA.4
#bit TXEN = TXSTA.5
#bit CSRC = TXSTA.7
#bit SPEN = RCSTA.7
#bit TXIE = PIE1.4

int indByte;

#int_tbe
void tbe_isr()
{
indByte ++;
TXREG=0x55;
}


void main()
{

BRG16 = 0;
SPBRG = 207;
SPBRGH =0;
SYNC = 1;
SPEN = 1;
CSRC = 1;
TXIE = 1;


while (TRUE)
{
//set_tris_c(0x00);
set_tris_c(0xC0);
enable_interrupts(GLOBAL);
enable_interrupts(INT_TBE);
TXREG=0x55;
indByte = 0;
while (indByte < 5)
{
TXEN = 1;
}
TXEN = 0;
disable_interrupts(INT_TBE);
}
}
Tony
Guest







problems CCS 3.224 OR EUSART PIC18F4525?
PostPosted: Thu May 19, 2005 12:25 am     Reply with quote

I'm waiting an answer.

Thanks
Tony
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 19, 2005 12:26 am     Reply with quote

I don't have a 18F4525 to test the problem in hardware.
I'll look at the code tomorrow.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 19, 2005 4:17 pm     Reply with quote

My version of the PCH compiler (vs. 3.188) doesn't support the 18F4525,
so I can't compile the code and look for problems in the .LST file.
I don't want to upgrade PCH just to do tech support, so I guess I can't
help you on this.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri May 20, 2005 2:15 am     Reply with quote

First a repeat of my previous suggestion, use the 'code' button when posting code!!! This will ensure the formatting of your code is preserved, making reading a lot easier to us.

In v3.224 I compared the listing files for both the 18F452 and 18F4525. Differences are in the initialization and #zero_ram, but the differences are minimal and after checking the registers I don't see any reason for failure.

I suggest to start testing your design at the lowest level. The 18F452 is working, but this is no garuantee the 18F4525 will. Maybe some difference in the clock input is causing problems. What frequency are you running and at what voltage? What does your clock circuit look like, is it a crystal or a real clock generator?

Just create a small test program blinking a led and tell us the results.
Tony
Guest







PostPosted: Fri May 20, 2005 3:42 am     Reply with quote

Crystal 8MHz and Voltage = 3V

But, did you try the code???
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri May 20, 2005 5:19 am     Reply with quote

Quote:
But, did you try the code???
No, I dont have an PIC18F4525. But have you tried this code?

I suspect that either you have a hardware problem or you are testing with other software than you are showing to us. It took you a very long time to come up with a compilable version....

Please try a very simple program that is only blinking a led and continue expanding from there until the program fails.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 20, 2005 10:44 am     Reply with quote

Quote:
Voltage = 3V


18F4525 does not run at 3v.

According to the 18F4525 data sheet, the minimum voltage
is 4.2v for all frequencys (up to 40 MHz).

You must have 18LF4525 to run at 3v.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sat May 21, 2005 7:29 am     Reply with quote

PCM programmer wrote:
Quote:
Voltage = 3V


18F4525 does not run at 3v.

According to the 18F4525 data sheet, the minimum voltage
is 4.2v for all frequencys (up to 40 MHz).

You must have 18LF4525 to run at 3v.

Good find PCM !
So I was right by suspecting a hardware problem. I checked the voltages for the PIC18F452 and these are the same, so either Tony was very lucky with the 18F452 working in his old design or he was using an 18LF452 and didn't give us the complete part number.
tony
Guest







problems CCS 3.224 OR EUSART PIC18F4525?
PostPosted: Mon May 23, 2005 2:01 am     Reply with quote

I have got PIC18F452, PIC18LF452, PIC18F4525, PIC18LF4525.

MPLAB 7.11 (or MPLAB6.60) and CCS 3.224

The code is doesn't work with PIC18LF4525 and with PIC18F4525!
The code works badly with PIC18LF452 and with PIC18F452!

MPLAB 6.60 and CCS 3.177

The code works well with PIC18LF452 and with PIC18F452!



[/b]
tony
Guest







problems CCS 3.224 OR EUSART PIC18F4525?
PostPosted: Mon May 23, 2005 2:01 am     Reply with quote

I have got PIC18F452, PIC18LF452, PIC18F4525, PIC18LF4525.

MPLAB 7.11 (or MPLAB6.60) and CCS 3.224

The code is doesn't work with PIC18LF4525 and with PIC18F4525!
The code works badly with PIC18LF452 and with PIC18F452!

MPLAB 6.60 and CCS 3.177

The code works well with PIC18LF452 and with PIC18F452!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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