Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 10, 2016, 11:19:28 23:19


Login with username, password and session length


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

Posts: 53

Thank You
-Given: 11
-Receive: 12


« on: February 05, 2011, 04:52:56 04: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
V.I.P
Active Member
*****
Offline Offline

Posts: 221

Thank You
-Given: 23
-Receive: 63


« Reply #1 on: February 09, 2011, 12:40:29 00: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 09, 2011, 12:50:27 00: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