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

UART not working 18f25k22

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ep.hobbyiest



Joined: 08 Oct 2014
Posts: 20

View user's profile Send private message Send e-mail

UART not working 18f25k22
PostPosted: Sat Sep 09, 2017 1:56 am     Reply with quote

Hi,
I am using pic18f25k22 PIC. Code is working on proteus but not on real hardware.
Led blinking is working properly on hardware.
Here is the code.
Code:
#include <main.h>

void main()
{

   while(TRUE)
   {
      //TODO: User Code
      printf("Live\r\n");
      delay_ms(1000);
   }

}


and main.h file is as

Code:
#include <18F25K22.h>
#device ADC=16

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)

#use delay(internal=16MHz)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=PORT1)
temtronic



Joined: 01 Jul 2010
Posts: 9197
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Sep 09, 2017 4:58 am     Reply with quote

Normally you will not get too many responses with 'Proteus' related questions. See PIC101.

My guess is that you've assigned the UART to a 'stream' AND you don't tell 'printf' to use that 'stream', so the PIC doesn't send data to whatever is attached to the PIC's UART pins. Not too sure where it goes but the listing would say.

Whenever you have project open, press F11, and the CCS C manual will 'popup'! Then you can quickly search and read about the various features and functions and syntax.

As you just found out Proteus does NOT work properly !! Even for SIMPLE code, it FAILS.

Jay
ep.hobbyiest



Joined: 08 Oct 2014
Posts: 20

View user's profile Send private message Send e-mail

PostPosted: Sat Sep 09, 2017 5:32 am     Reply with quote

Thanks. It worked. I checked the manual and i saw printf. So, i just use same printf function as normal stdio.h includes.
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