68kMLA Classic Interface

This is a version of the 68kMLA forums for viewing on your favorite old mac. Visitors on modern platforms may prefer the main site.

Click here to select a new forum.
TashIO: Clone of BeeHive Technologies's ADB I/O
Posted by: paws on 2023-09-11 07:56:30
Well, I accidentally an original Beehive (15EUR). Wonder what to do with it.
Posted by: Phipli on 2023-09-11 08:19:31
Well, I accidentally an original Beehive (15EUR). Wonder what to do with it.
Build an automated brewery and run it from an SE.

This is not optional.
Posted by: paws on 2023-09-11 10:11:09
... I don't drink and I don't like compacts! How about a pizzabox-driven pizza maker?
Posted by: Phipli on 2023-09-11 10:11:52
... 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?
Posted by: paws on 2023-09-11 13:38:42
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...
Posted by: pfuentes69 on 2023-10-24 00:51:47
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
Posted by: Tashtari on 2023-10-24 06:30:31
Here we are... I built the nice kit sent by @aladds
Nice build!
Posted by: aladds on 2023-10-24 11:08:21
Wonderful! Also make sure to credit @tashtari for the fantastic PIC code 😊
Posted by: pfuentes69 on 2023-10-24 12:02:32
Wonderful! Also make sure to credit @tashtari for the fantastic PIC code 😊
Sure! @tashtari is the PIC master.
I still have in my radar his TashTwenty!
Posted by: pfuentes69 on 2023-11-12 10:57:19
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...
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...
enum port    {
        A        = 2,        //Port A
        B        = 1            //Port B
};
Posted by: Phipli on 2023-11-12 11:05:14
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...
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...
enum port    {
        A        = 2,        //Port A
        B        = 1            //Port B
};
Aren't there only two ports?
Posted by: Phipli on 2023-11-12 11:15:05
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.
Posted by: pfuentes69 on 2023-11-12 11:42:01
Actually I meant "C language", sorry
Posted by: Phipli on 2023-11-12 11:43:50
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.
Posted by: pfuentes69 on 2023-11-12 11:50:15
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.
Posted by: pfuentes69 on 2023-11-12 11:52:53
Here are the libraries... just in case.
I use Code Warrior. The sample to get values works, and I modified it to set values.
Posted by: Phipli on 2023-11-12 11:58:38
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.
Posted by: pfuentes69 on 2023-11-12 12:16:11
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.
Posted by: pfuentes69 on 2023-11-13 09:41:56
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:
    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:
    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
Posted by: pfuentes69 on 2023-11-13 11:52:16
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.
< 7 >