Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 10, 2016, 02:06:09 02:06


Login with username, password and session length


Pages: [1]
Print
Author Topic: PIC18 Simulator IDE division  (Read 2698 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
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


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: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
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