LCD Print Question

I have a test sketch that I have been working on and I need some advice from the Arduino pro’s here on the form. What I’m trying to do is take the freq number (ex: 6000) and have it display as 146.000. The 14 and . are hard coded because that will never change. The problem I’m having is when the channel number is 401 (6005) It shows up at 146.00 (last digit is missing). I have done a lot of research on the net but, I have not come up with any information that is helpful. I wanted to ask the group here if you could give me some advise on what I’m doing wrong. Thank you

#include <LiquidCrystal.h>

LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

#define uint16 unsigned int
#define uint8 unsigned char
unsigned long Channel;

void setup(){

lcd.begin(20, 4); //VFD display 20 x 4
Channel = 400; //Set for 146.000
}

void loop(){
uint16 freq;

//Calculate actual frequency
freq = Channel*5 + 4000;

//Write frequency to display
first_line();
lcd.print(“14”);
lcd.print((uint8)(freq / 1000));
lcd.print(".");
lcd.print((uint8)((freq / 100) % 10) + “0”);
lcd.print((uint8)((freq / 10) % 10) + “0”);
lcd.print((uint8)(freq % 10) + “0”);
}

void first_line() //Sets LCD to first line
{
lcd.setCursor(0, 0);
}

Code tags please.

Read this before posting a programming question

Wouldn’t it be easier to turn it into a float (and add the 140) and then use dtostrf on it?

"0" is the address of the string containing the character 0 (zero) and a null.

'0' is the character 0 (zero).

--- bill

I thought about using float but the freq is 4 digits and does not have a decimal point. The number range will be 4000 to 8000 and because this is what the user will see I need to parse out each digit and place it in a certain position on the LCD. I thought I had it correct in my code but, it is not. I feel that I'm close but, I have been unable to find any good information on how to parse out this four digit number that each digit will change when a button is pressed.

Well a few minutes after my last post, I was able to find my problem. The code is working properly and I would like to that you all for the advise.

Maybe you could supply the answer to helps others who may come across this thread in the future ??