The Godfather talking
You can run, but you can't hide.
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 24, 2017, 11:08:18 11:08


Login with username, password and session length


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

Posts: 10

Thank You
-Given: 1
-Receive: 4


« on: January 04, 2009, 10:11:12 22: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
*****
Online Online

Posts: 4008

Thank You
-Given: 603
-Receive: 2050


There is no evidence that I muted SoNsIvRi


« Reply #1 on: January 05, 2009, 04:42:28 16: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: Did you buy a $5 key to by-pass a please invite me request   Then you forget to post in the forum, then your account maybe resticted
malibus
Newbie
*
 Muted
Offline Offline

Posts: 10

Thank You
-Given: 1
-Receive: 4


« Reply #2 on: January 06, 2009, 04:46:38 16: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: 271

Thank You
-Given: 123
-Receive: 304



« Reply #3 on: January 06, 2009, 07:47:59 19: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

Feel free to press "thank you" if you think you have found something useful! -^
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