Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Understanding Fosc (PIC18F4620)

Status
Not open for further replies.
str[11] or any other number just gives me a bigger piece of garbage on LCD and hyperterminal.
For example : str[20] gives me âájåRánPåRçÏÙ 

I am using C18 C Complier v3.40

I wish I could paste my entire code but my supervisor has issued a warning to me yesterday not to post my work online !

I will try to explain my work in words! I am sure my timers are initialized properly. Timer 0 creates an interrupt every second and Timer 1 acts as a counter to read RC1.

ReadTimer1(); gives an "int" output --> ultoa converts that to string --->LCD write string put it on the LCD / putrsUART do the same
 

str[11]
or any other number just gives me a bigger piece of garbage on LCD and hyperterminal.
For example : str[20] gives me âájåRánPåRçÏÙ

I would still recommend declaring the buffer as str[11] if you are going to use the ultoa().

The garbage displayed is obviously due to either the numerical to string conversion or the LCD routines.

Try using the itoa() function instead of ultoa() and report back the results.

Also have you tried using the sprintf()?

What is the size of the LCD, 16x2?

If you send a string literal to the LCD within the same program, is it displayed properly?


Do you have a debugger, ICD2, etc? If so and you put a breakpoint at the ultoa() routine, what is the value of timer value?

Without code, I'm shooting in the dark, I'm afraid.

BigDog
 
itoa() gives me the same result.

Yes LCD is 16x2 and yes other strings works absolutely fine.

I have a Pickit 3.

---------- Post added at 10:03 ---------- Previous post was at 09:47 ----------

sprintf() displays nothing!

I get this while debugging : PK3Err0040: The target device is not ready for debugging.
Please check your configuration bit settings and program
the device before proceeding.
 

I appreciate the update.

Obviously, there appears to be some issue with the numerical value to string conversion or the way the LCD routines handles the resulting string buffer from the conversion routine.

I'll write a similar example from scratch and see what issues I come across.

Although, I may have to deviate from the norm to deal with my PICDEM 2 Plus board's flaky LCD.

BigDog
 

    V

    Points: 2
    Helpful Answer Positive Rating
I get this while debugging : PK3Err0040: The target device is not ready for debugging.
Please check your configuration bit settings and program
the device before proceeding.

The above error message may possibly be due to the either the Low Voltage Programming not be disabled via configuration bit settings or the current version of the code loaded into the device does not contain the required hooks for the debugger.

There are, of course, other possibilities, however these are the two most common causes of an error of that type.

Was the code compiler as a "Release" or "Debug" version?

Another possible issue is the utilization of RB6 (PGC) and RB7 (PGD) within the design. Exclusive use of these two lines are required for debugging.

BigDog
 
Got UART to work.

Used "putsUSART" instead of "putrsUSART"

---------- Post added at 15:58 ---------- Previous post was at 15:56 ----------

Also initialized str as 'str[15]' as it has to store a 16 bit timer1 value
 

Re: Understanding Fosc (PIC18F4620) J20-J23 Jumpers

Hi All,
I am designing an I2C Sensor network using the PicDem 2 Plus and i am attempting to attach my own external Sensors to show the ability to have multiple sensors on the same SCL and SDA lines. The PicDem 2 Plus Users manual describes the J20-J22 Jumpers below:

TABLE 1-1: ON-BOARD JUMPER CONNECTIONS
Jumper Connection
J6 --> LEDs to PORTB
J7 --> On-board RC oscillator to PIC® MCUs
J9 --> Piezo buzzer to RC2 pin (*on 40-pin mid-range device, this is CCP1)
J10 --> VCAP connection for devices with on-chip voltage regulator
J12 --> 2.7V source to RA1 (voltage divider off of 9V input voltage)
J14, 15, 16, 17 --> PICkit™ Serial Header to I2C™ bus
J18,19 --> Tx and Rx from RS-232 components to PIC MCUs
**J20, 21, 22, 23 --> PIC MCUs to I2C bus**
J24 --> RA4 pin to RC2

These Jumper connections, however, are never detailed at which is the GND, VDD, SCL, SDA lines. Does anyone have any experience adding external sensors to this dev board? I have emailed microchip (the only email tech help is a chinese email address) and they continually direct me to the users manual which has only the information shown above.

Can anyone give me insight on how to connect external I2C sensors to the dev board?

Thanks for everyone's help!

Tmab
 

Hey Tmab , in a week or two I would have to attach 2 photo sensor to my pic dem board too. Probably then I may be able to share my experience with you!
 

haha good to have a reply Neyolight!

I actually already figured out the pin configurations. Now I am having trouble getting a real reading from my Honeywell I2C Pressure sensor. With this sensor, the ACK is sent from the sensor and then the data is transmitted. I am having trouble seeing the ACK and am unsure if the data I am seeing from the sensor is good or not. During debugging the sensor only puts out 7FFF which I have to assume is a response from the sensor because of the 7 bit. When the program is run, however, I am not getting data from the sensor. Unfortunately Honeywell has no example I2C programming to help me.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top