Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 10:52:36 22:52


Login with username, password and session length


Pages: [1]
Print
Author Topic: PIC18 Simulator IDE division  (Read 5611 times)
0 Members and 1 Guest are viewing this topic.
malibus
Newbie
*
Offline Offline

Posts: 10

Thank You
-Given: 1
-Receive: 4


« on: January 04, 2009, 09:11:12 21:11 »

Hi,
I am working on a voltmeter, in PIC18 Simulator IDE.
How make a division of two integers, and get the 2 numbers after the decimal point?
If this possible?

Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4667

Thank You
-Given: 834
-Receive: 4321


There is no evidence that I muted SoNsIvRi


« Reply #1 on: January 05, 2009, 03:42:28 15:42 »

me thinks you need to read up on maths, integers are whole numbers, you can't have a decimal place.
I can't see what you are trying to do with above problem. to use a pic as a voltmeter = one analoge input. and a display, be it leda or lcd.
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
malibus
Newbie
*
Offline Offline

Posts: 10

Thank You
-Given: 1
-Receive: 4


« Reply #2 on: January 06, 2009, 03:46:38 15:46 »

Yes, i can measure a tension,  in milivolts the result is ok. For example 18235.
How put to the lcd this value, but expressed in V  ( 18.235V) without division on 1000?

Logged
mbandala
Senior Member
****
Offline Offline

Posts: 279

Thank You
-Given: 130
-Receive: 305



« Reply #3 on: January 06, 2009, 06:47:59 18:47 »

I don't suppose you are using assembler. That shouldn't be difficult using C for instance. If you don't want to divide just convert "18235" into BCD notation (0x18235, note: such a big number cannot be held by an "int" use "unsigned short long" instead) and then send nibble by nibble to the LCD. You can position the decimal point accordingly this way.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC