• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

TashIO: Clone of BeeHive Technologies's ADB I/O

Phipli

Well-known member
... I don't drink and I don't like compacts! How about a pizzabox-driven pizza maker?
Meh, you could do that with a timer relay. Or did you mean actually making the bread and toppings?

Automated cookie maker?
 

paws

Well-known member
Yeah, a fully automatic dough kneader-flattener and automated cheese grating.

Reading the application notes, I see mentions of controlling this with Telnet via Hypercard? Wild stuff...
 

pfuentes69

Well-known member
Here we are... I built the nice kit sent by @aladds
It's detected by the system, now I need to figure out a project... I was thinking on some way to send from the internet a command to the Mac and turn on/off a lamp... But I need to figure out how to use TCP/IP from C/C++

IMG_4643.jpeg
 

pfuentes69

Well-known member
Has anyone managed to use C to set port values?
Port A works... I can set values, but I need to set values in port B, configured as output.

The library strangely only has function ADBIOSetPortA but not an ADBIOSetPortB.
I tried to copy the function for port A and make the equivalent for B, but it didn't work.
This is the function...
Code:
pascal OSErr  ADBIOSetPortA(Byte theAddress,long theChannel,enum value theValue,long theTime)
{
OSErr            myErr;
Byte            dataTransmitted;
Byte            DataBuffer[3], Listen,ADBReg;
unsigned short    ADBIOCompletionPPC[3] = {0x14BC, 0x0001, 0x4E75};

    ADBReg = 2;                // set the port to enumerated A

    dataTransmitted = 0;                                    //set up completionflag
    DataBuffer[0] = 2;
    DataBuffer[1] = (theValue == high) ? theChannel - 1 & 0x03 | 0x40 : theChannel - 1 & 0x03 ;
    DataBuffer[2] = theTime;
    if (CountADBs() == 0) return errAINoADBs; //no devices connected to the bus
    Listen = (theAddress << 4) + 8 + ADBReg;

    #if GENERATINGPOWERPC
     myErr = ADBOp ((Ptr)&dataTransmitted,(UniversalProcPtr)ADBIOCompletionPPC,(Ptr)DataBuffer,Listen);
    #else
     myErr = ADBOp ((Ptr)&dataTransmitted,(ADBServiceRoutineUPP)ADBIOCompletion68k,(Ptr)DataBuffer,Listen);
    #endif   

    if (myErr != noErr) {
         return myErr;
    }
    while(!dataTransmitted);             // Loop until ADBOp has completed
    return noErr;
}

I tried changing ADBReg to 1 (or B), as in the header I can see...
Code:
enum port    {
        A        = 2,        //Port A
        B        = 1            //Port B
};
 

Phipli

Well-known member
Has anyone managed to use C to set port values?
Port A works... I can set values, but I need to set values in port B, configured as output.

The library strangely only has function ADBIOSetPortA but not an ADBIOSetPortB.
I tried to copy the function for port A and make the equivalent for B, but it didn't work.
This is the function...
Code:
pascal OSErr  ADBIOSetPortA(Byte theAddress,long theChannel,enum value theValue,long theTime)
{
OSErr            myErr;
Byte            dataTransmitted;
Byte            DataBuffer[3], Listen,ADBReg;
unsigned short    ADBIOCompletionPPC[3] = {0x14BC, 0x0001, 0x4E75};

    ADBReg = 2;                // set the port to enumerated A

    dataTransmitted = 0;                                    //set up completionflag
    DataBuffer[0] = 2;
    DataBuffer[1] = (theValue == high) ? theChannel - 1 & 0x03 | 0x40 : theChannel - 1 & 0x03 ;
    DataBuffer[2] = theTime;
    if (CountADBs() == 0) return errAINoADBs; //no devices connected to the bus
    Listen = (theAddress << 4) + 8 + ADBReg;

    #if GENERATINGPOWERPC
     myErr = ADBOp ((Ptr)&dataTransmitted,(UniversalProcPtr)ADBIOCompletionPPC,(Ptr)DataBuffer,Listen);
    #else
     myErr = ADBOp ((Ptr)&dataTransmitted,(ADBServiceRoutineUPP)ADBIOCompletion68k,(Ptr)DataBuffer,Listen);
    #endif  

    if (myErr != noErr) {
         return myErr;
    }
    while(!dataTransmitted);             // Loop until ADBOp has completed
    return noErr;
}

I tried changing ADBReg to 1 (or B), as in the header I can see...
Code:
enum port    {
        A        = 2,        //Port A
        B        = 1            //Port B
};
Aren't there only two ports?
 

Phipli

Well-known member
Ah, I see, you just mean Port B on the device and are mentioning that it is Port C on the PIC. I'd ignore the naming on the PIC pins, it shouldn't matter at all from the computer side and is slightly confusing to mention it with it contradicting the name on the box and computer.
 

Phipli

Well-known member
The command
Actually I meant "C language", sorry
Hah, sorry, my bad. I got muddled.

I haven't used C to control one, but usually you have to set up the port direction and mode before using "set". Are you sure there aren't more commands to set up the port?

I don't have the C library to hand.
 

pfuentes69

Well-known member
The command

Hah, sorry, my bad. I got muddled.

I haven't used C to control one, but usually you have to set up the port direction and mode before using "set". Are you sure there aren't more commands to set up the port?

I don't have the C library to hand.
Setting port A with the included function works fine (I can hear the relays) but I don't manage to set port B... I wonder why they only gave a function to set port A in the library...
Using the hypercard tool all works fine.
 

pfuentes69

Well-known member
Here are the libraries... just in case.
I use Code Warrior. The sample to get values works, and I modified it to set values.
 

Attachments

  • ADB_IO_C-Interfaces_CW.sit.hqx
    217 KB · Views: 0
  • ADB_IO_C-Interfaces.sit.hqx
    110.3 KB · Views: 0

Phipli

Well-known member
Setting port A with the included function works fine (I can hear the relays) but I don't manage to set port B... I wonder why they only gave a function to set port A in the library...
Using the hypercard tool all works fine.
Only one of the ports has relays, the other uses transistors that won't click.
 

pfuentes69

Well-known member
Only one of the ports has relays, the other uses transistors that won't click.
Yeah… I’m testing port B with LEDs, which I can light with the HyperTalk tool.
In port A I don’t have anything connected, but I know it works from C as I can hear the relays.
 

pfuentes69

Well-known member
I did some more tests and it's clear that the function ADBIOSetPortA does some magic tricks I don't fully understand...
Checking these lines:
Code:
    ADBReg = 2;   // set the port to enumerated A
    dataTransmitted = 0;   //set up completionflag
    DataBuffer[0] = 2;
And considering that Port A is an enum = 2, I tried this:
Code:
    ADBReg = B;   // set the port to enumerated B
    dataTransmitted = 0;   //set up completionflag
    DataBuffer[0] = B;
As "B" is an enum value = 1.
Then I can get to start changing values in port B, but it's not working right. I think the other lines which do some bit-wise operations need to be changed.

Bottom line: I'm lost
 

pfuentes69

Well-known member
I keep digging... I see that this must be always like this:
DataBuffer[0] = 2;
As this means that we're sending 2 bytes of data.

EDIT: I think there's no direct command for setting port B and what the Hypercard tool does is to use the command to configure the port, which allows too to set values.
 
Last edited:
Top