The Godfather talking
This is god damn my place! Capisci?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 29, 2024, 04:58:33 16:58


Login with username, password and session length


Pages: [1]
Print
Author Topic: Function argument  (Read 3624 times)
0 Members and 1 Guest are viewing this topic.
odsk
Junior Member
**
Offline Offline

Posts: 53

Thank You
-Given: 13
-Receive: 12


« on: February 05, 2011, 03:52:56 03:52 »

Hi,
Using MicroBasic 4.15 and could not figure out how to make a function where one of the argument is a port pin (example PORTB.3). Anybody knows a trick to do that?
Thanks,
ODSK
Logged
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #1 on: February 08, 2011, 11:40:29 23:40 »

You can assign a variable to PORTB.3 (type bit or sbit) pass it to a function. In your function, use setb, clrb and testb to alter the return bit value (another variable).

Actually, TestBit(PORTB, 3)  is a FUNCTION. When you call TestBit(PORTB, 3), you already pass argument to the function. It will return 1 or zero. Why don't you go into the library and take a look at the TestBit function to see how they wrote the routine.

However, I am not really understand what you want to do.


If you have not  figgure it out, then post your program, I or other members may be able to help.

Tom
« Last Edit: February 08, 2011, 11:50:27 23:50 by TomJackson69 » Logged

Con Rong Chau Tien
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