Simple open source GPIB controller with AVR processor

Go To Last Post
93 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simple open-source GPIB controller with AVR processor (with buffers with inverted output   , open collectors ( SN7438N  , transistors BC547(BC847) +10kOhm  ) and   with noninverted output(74HC245) , open collector (or emulation using diodes 1N4148 , fix values  of the resistors )). May be with forced DAV=low  option for some old  devices  with clone of the GPIB bus .  You can rename bus pins for standard bus  pin names  (for NI488.1, DIO1-DIO8, REN,IFC, EOI, ATN,DAV,NRFD,NDAC  ( for negative logic, as for the GPIB bus , 0-high(pull-up only), 1-low  )  )   . Some circuits are temporary circuits for optimizing .      In this circuit was used modifyed Terentjev's circuit prototype. 

 

For compiling host applications  in the Embarcadero BC102 mode you must disable "#define BCC5_FCT 1 //enable for BCC 5.5.1 "

AVR program may be compiled in the  WinAVR or  in the AtmelStudio 7 with C++ toolchain, for other compilers  rebuild program and includes. 

For better results you can write .asm-equivalent of this program (after optimizing of this codes and circuits for your hard and host applications). 

 

Some elements are only for emulation  , may be abstract, with options  (open collector, inverted ) . 

 

(I remove files with bugs  )

 

 

Attachment(s): 

Last Edited: Fri. Feb 4, 2022 - 05:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can rebuild it for 38400 baud (stable) ,modify some delays and subroutines , modify this circuits   for your devices , fix some bugs , add some subroutines  , rebuild  using ATMEGA16A  , ...  .

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

May be compatible   with  GPIB Terminal V1.0 (a prototype from the radio.ru , but  this is a program for  other project , another author, may be with some problems  , this is a prototype  ).

 

https://ftp.radio.ru/pub/2010/01/GPIB-UART.zip  (a prototype, but with bugs, errors in the fusebits  and dangerous circuit of the buffers).

Attachment(s): 

Last Edited: Mon. Jan 31, 2022 - 01:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GPIB byte   handshake flow chart  .  

 

Last Edited: Fri. Dec 24, 2021 - 07:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

AH(Acceptor handshake) and L( Listener)  functions 

 

Attachment(s): 

Last Edited: Thu. Dec 30, 2021 - 10:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

SH Source handshake and T (Talker, source)  functions (about LE,TE functions    later  ,  they are not used now  , see documents about NI488.1 ,GPIB   ):

 

Attachment(s): 

Last Edited: Thu. Jan 6, 2022 - 08:34 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Remote, local functions (RL):

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SRQ(request), DC(device clear ),DT (device triggering )  and PP2(for parallel polling )  functions .  

 

t5<=200 ns,t2<=200ns,T1 >=2us

 

 

A Controller (C) function (may be simplifyed , but may be a problem with SRQ  I/O control  pin for   (for  simple circuit  with ATMEGA8A-PU for simple commands and modes ) ). 

Temporary it is possinle to create a simple i/o  tool for using with devices with simple L,T, AH,SH,RL. 

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can fix design of the combobox with commands  for  OTA (TAG.MTA) command  etc. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For checking RENS, AH,L,UNL,GTL I use  simple model of the acceptor-listener(it may be with more functions, but it is with ANRS->ACRS problem , circuit may be with bugs   ,  for some  mantrid.ru projects ,  http://www.mantrid.ru/forum/show...    ,check  buffers and daccept and strobe  circuit, SN5409 (133li1) and  SN7409 for NRFD and NDAC are without invertors (but some  datasheets  of the analogs  are with bugs  )  , they are not 7401(155la8) circuits and not SN7408  (for some sites with bugs ), '^' was '#' used for debug   ):

 

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

  Screenshot of the  GUI of the host program . 

 

 

 

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fixed initialization of the ports and the moment of the TE=1  before making bits of the  ports B and C   outputs  (because default values after reset : DDDx =0 (input ), pull down  ).

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Problem with sending 0x89 if insert  parity  check subroutine  (type  mismatch for char, with unsigned char or byte  problem with type conversion )

bool SendDB_HS(HWND  Dlg)
{
char buf[4];
GetDlgItemText(Dlg, IDC_DIO_SEND_TXT,  buf , 3);
 char i = (char)((( (getData1( buf[0])&0xff<<4)+getData1( buf[1]) ) ))   ;

char i = (char)  ((getData1( buf[0])&0xff)<<4);
i+=(char) (getData1( buf[1])&0xff)     ;

int i1=(int)(i&0xFF);
//char p[17];
//itoa (i, p, 16);
//MessageBox(Dlg, p , lpProjName, MB_OK);
char str [4];
AppendWindowText(Dlg,  "\r\nSend DB:  ");
sprintf(str ,"0x%0.2X", (int)  i1 );
AppendWindowText(Dlg,  str);
AppendWindowText(Dlg,  "   ");
AppendWindowText(Dlg,(char *)  decoder ( i , 0));

//if (Forced==1) {   WriteByte('^');   } else { WriteByte('#');  }
 WriteByte('#'); 
 WriteByte((byte)i1); 

//OutParity( Dlg,  (byte)(i1&0xff));

 UpdateWindow(Dlg);
if (Forced==1)  { AppendWindowText(Dlg,  "\r\nForced set DAV=low for HS"); }
switch(ReadByte())
{
case 0x02:
    //TX HS error
     SetDlgItemText(Dlg, IDC_STATUS,  " TX handshake error" );
     //   CheckControl(Dlg); UpdateWindow(Dlg);
     AppendWindowText(Dlg,  "\r\nHandshake error "); UpdateWindow(Dlg);
     return 0;
     break;
 case 0x03:
     //TX HS success
     SetDlgItemText(Dlg, IDC_STATUS,  " TX handshake OK" );
     CheckControl(Dlg); UpdateWindow(Dlg);
     AppendWindowText(Dlg,  "\r\n OK  ");
     return 1;
    break;
 default:
      SetDlgItemText(Dlg, IDC_STATUS,  "  Error                       " );
      CheckControl(Dlg); UpdateWindow(Dlg);
      AppendWindowText(Dlg,  "\r\n I/O Error ");
      return 0;
     break;
}
return 0;
}

 

Last Edited: Sat. Jan 1, 2022 - 05:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For  parity check :


/*

if paritybit=1 then DBbyte+=128 (0x80) ;
// for  decode  DB&=0x7f;  
7 bits of data;    (count of 1-bits)  ;	8 bits including parity
                              ;      check   even   =OK	;             check     odd= OK

0x01;   b0000001;        1;; 0x81;[1]0000001	;0x01; [0]0000001 
0x02;   b0000010;        1;; 0x82;[1]0000010	;0x02; [0]0000010 
0x03;   b0000011;        2;; 0x03;[0]0000011	;0x83; [1]0000011 
0x04;   b0000100;        1;; 0x84;[1]0000100	;0x04; [0]0000100 
0x05;   b0000101;        2;; 0x05;[0]0000101	;0x85; [1]0000101 
0x06;   b0000110;        2;; 0x06;[0]0000110	;0x86; [1]0000110 
0x07;   b0000110;        3;; 0x87;[1]0000111	;0x07; [0]0000111 
0x08;   b0001000;        1;; 0x88;[1]0001000	;0x08; [0]0001000 
0x09;   b0001001;        2;; 0x09;[0]0001001	;0x89; [1]0001001 
0x11;   b0010001;        2;; 0x11;[0]0010001	;0x91; [1]0010001 
0x14;   b0010100;        2;; 0x14;[0]0010100	;0x94; [1]0010100 
0x15;   b0010101;        3;; 0x95;[1]0010101	;0x15; [0]0010101 
0x18;   b0011000;        2;; 0x18;[0]0011000	;0x98; [1]0011000 
0x19;   b0011001;        3;; 0x99;[1]0011001	;0x09; [0]0010101 
0x20;   b0100000;        1;; 0xA0;[1]0100000	;0x20; [0]0100000 
0x21;   b0100001;        2;; 0x21;[0]0100001	;0xA1; [1]0100001 
0x40;   b1000000;        1;; 0xC0;[1]1000000	;0x40; [0]1000000 
0x41;   b0011000;        2;; 0x41;[0]0011000	;0xC1; [1]1000001 

0x00;   b0000000;	0; 0x00;[0]0000000	;0x80; [1]0000000
0x51;   b1010001;	3; 0xD1;[1]1010001	;0x51; [0]1010001
0x69;   b1101001;	4; 0x69;[0]1101001	;0xE9; [1]1101001
0x7F;   b1111111;	7; 0xFF;[1]1111111 	;0x7F; [0]1111111
0x03;   b0000011;	2; 0x03;[0]0000011	;0x83; [1]0000011
*/ 
byte OddCheck=0; 
byte Compare=0; 
void OutParity(HWND  Dlg,  byte bt)
{
byte i,  tmp1=0 ;
for (  i=0; i<8; i++) {   if((bt&0x01)!=0 )     tmp1+=1;  bt=(byte)(bt>>1);  }
if((byte)(tmp1%2)!=0 ) 
{   
SendMessage(GetDlgItem(  Dlg,   IDC_ODD  ) ,  BM_SETCHECK ,TRUE,  0);       
if(Compare==1){  if (OddCheck==0) {       MessageBox(Dlg, "Even parity error !" , "Error", MB_OK);     } }
}  
else 
{ 
SendMessage(GetDlgItem(  Dlg,   IDC_ODD  ) ,  BM_SETCHECK ,FALSE,  0);  
if(Compare==1){ if (OddCheck==1) {    MessageBox(Dlg, "Odd parity error !" , "Error", MB_OK);     }         } 
}
 
}

But you can use XOR of bits(DIO1-DIO7 TTL ) ,PB  DIO8(TTL ) and minterm  (0 or 1 ). 

Is this  correct . 

With host API we have problem with type overloading  and conversion of the types. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does anyone still use GPIB? I have not seen a GPIB device for 20+ years!

 

Jim

 

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With HC245, handling of Input data is slower, because '0' is created on resistor of 15k. In a range of us, perhaps.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A program with parity checking ( with bugs for    data input (type conversion problem )).

Attachment(s): 

Last Edited: Thu. Dec 30, 2021 - 11:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
Does anyone still use GPIB? I have not seen a GPIB device for 20+ years!

 

yep, I remember those on the Wiltron and HP scalar network, spectrum analyzers and sweepers and circa 1999? 

I reserve my right to assemble!
Brawndo's got what plants crave... It's got electrolytes!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fixed byte-> char->int ,  int,char->byte  in the StrDIO1 and StrDIO2  for sending and for reading data (for example , reading and sending 0x89  , without parity , but used mask ch&0x7f for data    ). UART now with  timeouts .    

Check some bugs. Used KOI7-N0 (default) or ASCII English  (UTF-8). KOI7-N1 is an experimental option. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Commands for example

IDY=0, off , default mode
Set REN=1
Send IFC=1 pulse

Parity off , no odd , 2 us
Send    commands   via  handshake algorithm  :
0: ATN=1, Send command: 0x5f UNT
1: ATN=1, Send command: 0x2A MLA ( ADL,   select addr 10 (0x0A) before sending )         //local control  was disabled
Send  mode switch data bytes via handshake  algorithm :
2,3: ATN=0, Send  data: 0x49 0x31 ("I1")     mode "0.1-0.22"      (delay 0.1 s ... 1 s between strings  )
4,5: ATN=0, Send  data: 0x49 0x32  ("I2")    mode "0.9-1.5"
6,7: ATN=0, Send  data: 0x49 0x63  ("I3")     mode "1.8-3"
8,9: ATN=0, Send  data: 0x49 0x64  ("I4")    mode "0.1-4"
10,11: ATN=0, Send  data: 0x49 0x38  ("I8")    mode "4-32"
12,13: ATN=0, Send  data: 0x49 0x3C  ("I<")     mode "18-1000"
14,15: ATN=0, Send  data: 0x41 0x30  ("A0")     mode  "PM"
16,17: ATN=0, Send  data: 0x41 0x31  ("A1")     mode  "FM"
18,19: ATN=0, Send  data: 0x41 0x32  ("A2")     mode  "AM"
20,21: ATN=0, Send  data: 0x41 0x33  ("A3")     mode  "IVL" (level)
22,23: ATN=0, Send  data: 0x41 0x31  ("A1")     mode  "FM"
24,25: ATN=0, Send  data: 0x42 0x32  ("B2")     mode  "-"
26,27: ATN=0, Send  data: 0x42 0x31  ("B1")     mode  "RMS"
28,29: ATN=0, Send  data: 0x43 0x31 ("C1")     mode  "60"
30,31: ATN=0, Send  data: 0x43 0x32 ("C2")     mode  "20"
32,33: ATN=0, Send  data: 0x43 0x33 ("C3")     mode  "3.4"
34,35: ATN=0, Send  data: 0x42 0x30 ("B0")     mode  "THD"
36,37: ATN=0, Send  data: 0x44 0x30 ("D0")     mode  "0.3"
38,39: ATN=0, Send  data: 0x44 0x32 ("D2")     mode  "LNM"
40,41: ATN=0, Send  data: 0x44 0x33 ("D3")     mode  "QM"
42,43: ATN=0, Send  data: 0x42 0x33 ("B3")     mode  "+"
44,45: ATN=0, Send  data: 0x44 0x31 ("D1")     mode  "0.02"
46,47: ATN=0, Send  data: 0x43 0x30 ("C0")     mode  "200"
//
Send commands  via  HS  algorithm :
48: Send GET: ATN=1, 0x08 GET (for group exec. trigg. ) //check SRQ=1
49: Send MTA Addr=10dec: ATN=1,0x4A MTA  (ADT, select addr 10 (0x0A) before sending )
//compare=1(on) , stop on compare  for line 49 of the program
//code for comparing: ATN=1, DB=0x4A
Wait for SRQ=1 after  sending MTA command  (ATN=1,DB=0x4A)

For STB manual send
50: Send SPE via HS algorithm: set ATN=1,DB=0x18(send SPE command -> now SPMS=1   )
Manual read STB (from the acceptor as  the Talker)
(->STB if SPAS=1(after MTA hs(),if ATN=0^SPMS=1(after SPE(ATN=1,0x18 hs()),before SPD(ATN=1,0x19 hs())  ))
51:  Set ATN=0.Read byte STB (hs) :  0x40 (100 oct , ROM Ok  , bit 6 RQS=1, if SPAS=1   )
manual send
52:  Send SPD via HS: set ATN=1, DB=0x19 (send SPD command ,->SPMS=0,go to SPIS,TADS )

For manual read (from the acceptor as the Talker), // SRQ=1 after  MTA or GET
53:  Set ATN=0
 (if SPMS=0(SPIS=1,after SPD) and MTA is Ok(TADS statement) go to TACS statement, for reading DABs )
 Receive 13 bytes (DAB) via handshake(for example,for 007 Hz)
Read DB:0x48   =110 oct, 'H'
Read DB:0x5A   =132 oct, 'z'
Read DB:0x20   =040 oct, 'space'
Read DB:0x20   =040 oct, 'space'
Read DB:0x30   =060 oct,'0'
Read DB:0x30   =060 oct,'0'
Read DB:0x30   =060 oct,'0'
Read DB:0x30  =060 oct,'0'
Read DB:0x37  =067 oct,'7'
Read DB:0x45  =105 oct,'E'
Read DB:0x2B  =053 oct,'+'
Read DB:0x30  =060 oct,'0'
Read DB:0x30  =060 oct,'0'     ->  EOI=1 (byte may be  0x0a) , end of data message (using EOI=1 as EOS for stop reading DABs) 

->"Hz  00007E+00"
(Send UNL  / UNT )
Set REN=0
/***** other example  *****/
//Set mode  Freq. A
0 Send IFC=1
1 Set    REN=1
2 Send command (Set ATN=1)  UNL (0x3f)
3 Send command (Set ATN=1)  MLA addr (selected address)
4 Set  ATN=0
     Send string     "FA[LF]"  (or  R[LF]   , K[LF] , C[LF], Q[LF], FV[LF], TA[LF], TI[LF], TIA[LF], FBA[LF], FVA[LF],  )
5   ATN=0) Send DAB 0x46 (F)    
6   ATN=0 Send DAB 0x41 (A)
7   ATN=0 Send DAB (EOS)  0x0a  (LF) 
8  Send command (Set ATN=1)  UNL (0x3f)

//Reading data:
0 Send IFC=1
1 Set REN=1
2 Send command (set ATN=1)  UNL (0x3f)
3 Send command (set ATN=1)  0x20|MLA addr (selected address)
4 Send command (set ATN=1)  GET(0x08)  
4 Send command (set ATN=1)  0x40|MTA addr (selected address)
    //  check SRQ=1   after MTA  hs()
5** Send command (set ATN=1) 0x08 GET  (for new results )
//for reading STB
6*  Send SPE via  HS  algorithm  :   set ATN=1, DB=0x18  (send command SPE , ->SPMS=1 )
7*  Set ATN=0   (  -> now SPAS=1)
      read STB  ->( STB if SPAS (after  MTA hs() , if ATN=0^SPMS=1 (after SPE  (ATN=1, 0x18 hs()), before SPD (ATN=1, 0x19 hs())  ))
      STB=0x40    (bit 6 =RQS=1 , bit 3-addr.cancelling, bit1=prog. error)
      STB=0x42,0x02 error
      STB=0x44,0x04 addr. cancelling
8*  Send SPD via  HS algorithm: set ATN=1, DB=0x19   (send command SPD , -> SPMS=0,  SPIS=1,  go to TADS if  MTA  Ok   )
//for reading DABs

9    Set ATN=0  (may be after  MTA (after GET), if  SPMS=0  go to TACS statement , SRQ=1 (may be,but  see your instruction for your device) )
      Read DAB  bytes    with meas. result  (max. 32  bytes  )

->"F[SPACE]MHZ[SPACE]+0.1000000E-02[LF(0x0a) with EOI=1]"    (EOS=0x0a, EOI=1)
->"T[SPACE]мкс[SPACE]+0.100E+05[LF with EOI=1]"
10 Send command (ATN=1)  UNL (0x3f) ( UNT? )
11 Set REN=0, ATN=0

//

 

 

 

 

For SPE and after MTA  use "Read DB" (via handshake) for reading bytes (default ATN=0  for this operations , check ATN=0 if  read DAB  manually ).  

DIO? is for reading DAB from bus if    no handshake (for reading ) or for some  events with IDY/PPE . 

Last Edited: Wed. Jan 19, 2022 - 04:26 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems quite a few people still use GPIB. I recently was involved in the design of an upgrade board for the HP series 80 computers which were widely used as controllers for testing. Most of the people who bought the boards used their machine for GPIB. There’s still a lot of HP gear out there esp their spectrum analysers and vnas.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
Does anyone still use GPIB? I have not seen a GPIB device for 20+ years!

Kartman wrote:
HP series 80 computers which were widely used as controllers for testing.

Yikes, GPIB, I have not worked with that since 1984! Used an HP desktop to run some testing of seismic data acquisition equipment before sending same out to the field! 

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This controller can send bytes  using '#x' mode  of the handshake (not only with '^x'  ,for debug  only  ,may be removed ). 

Model of the simple virtual  test acceptor-listener:  

 

 

Attachment(s): 

Last Edited: Wed. Dec 29, 2021 - 10:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why are you sending out a horrific mish-mash of random postings with little or no explanation?

Can't you send ONE post with a clear explanation of everything??

Then it will be something someone can read from beginning to end in an organized manner to fully appreciate the great effort & apparent progress you have made!

Too many wonderful projects get cancelled or tossed in the trashcan because they weren't communicated effectively.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1


I'm still looking for the "simple" part in the title of this OP

This seems like an odd way to get an open collector gate, when they have always been available, i.e. 7401 nand, and I think most bus transceivers have an /oe pin, like I said, where is the simple part?

By the way, have you looked at the cost of GPIB cables and connectors?  simple does not always mean low cost

 

Jim

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Buffers are with open collectors ((SN)74LS38 ) or an emulation  with diodes . Use pull-up resistor for  direction switch invertor if  it is  with 2SC9014 +10kOhm,1kOhm or if it is a part of (SN)74LS05   .  This mode was selected  in the simulator. 

Last Edited: Mon. Dec 27, 2021 - 09:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But you can rebuild it for SN75160,SN75161,SN75162 ( not avaliable for me now ).

Last Edited: Mon. Dec 27, 2021 - 10:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SN74LS01 Iol max=8 mA, SN74LS38 Iol max=12...24 mA  Rinp pull-up =17 kOhm(Shottky) ,    7401 with 4 kOhm  input (it may be  a problem for AVR out  ).

Last Edited: Mon. Dec 27, 2021 - 10:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For  all non-inverted buffers with open-collector (SN75160,SN75161(75162), if for talker  TE=1 , for  reading from EOI  bus  nDL=0 ):

Added 0x1f command (CFE for ATN=1) to the menu .

Removed  temporary options   '^' and 'forced'  (they are temporary, used  for debug ). 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For  all non-inverted buffers with open-collector (SN75160,SN75161(75162), if for talker  TE=1 , for  reading from EOI  bus  nDL=0 ):

 

Why are you showing this diagram?  Is this a known working schematic or some problem needing to be discussed? It appears to be on the 4th iteration now, your purpose is not clear.   Where are your pin numbers (what good is this)?

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Removed option : 'forced'  and '^'    (  fixed bug in the circuit , NRFD,NDAC are with only one invertor+buffer with OC, not with 2 invertors    ) .

The circuit of the test  acceptor-listener  for simulation :

Attachment(s): 

Last Edited: Wed. Dec 29, 2021 - 11:15 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You now seem to have posted a "gpibtool.zip" about four times, plus several other zip files (some more than once).

 

Can't help thinking that a proper repository with revision tracking (eg, GitHub) would be a far more appropriate & useful approach ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Why are you sending out a horrific mish-mash of random postings with little or no explanation?

Can't you send ONE post with a clear explanation of everything??

Then it will be something someone can read from beginning to end in an organized manner to fully appreciate the great effort & apparent progress you have made!

Too many wonderful projects get cancelled or tossed in the trashcan because they weren't communicated effectively.

 

It appears you have been already locked out of several for spam, is this another?

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Wed. Dec 29, 2021 - 04:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The are 3 editions: with buffers with invertors and OC, with buffers with OC and without inversion , with invertors  only for  control lines (with virtual acceptors for testing  ).    Option forced was removed (it was used for  bug finding ). 

 gpibtool2.zip was reloaded with fixed circuits , models and with circuits of the virtual simple test acceptors  (for  emulating in the SimulIDE ) . May be with some bugs.

Attachment(s): 

Last Edited: Thu. Dec 30, 2021 - 10:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For  all non-inverted buffers with open-collector (SN75160,SN75161(75162), if for talker  TE=1 , for  reading from EOI  bus  nDL=0 ):

 

Why are you showing this diagram?  Is this a known working schematic or some problem needing to be discussed? It appears to be on the 4th iteration now, your purpose is not clear.   Where are your pin numbers (what good is this)?

 

 

This is an alternative circuit of the controller. 

Last Edited: Wed. Dec 29, 2021 - 09:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

The screenshots of  the programs .

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rpz3598 wrote:

if (Forced==1) {   WriteByte('^');   } else { WriteByte('#');  }

//if (Forced==1) {   WriteByte('^');   } else { WriteByte('#');  }
  WriteByte('#');  

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is possible to add a comparator mode for DB comparing with value from input box (EditBox).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is possible to add a comparator mode for DB comparing with value from input box (EditBox).

So what?  Why did you not put that information in your first post?  It is likely that you are wasting too much time, no one is going to pay attention reading your stuff one sentence at a time.

It doesn't seem like any of these will work with all the errors and mistakes that they have.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It can work in the Windows 10,Windows 11 (with VEN24, FT232BL,CP210x ,CH34x, CH382   ).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fix bug with  IFC  (for  project with all buffers with invertors    ,  PINС2   )

//for IFC, DB,REN, ATN ,SRQ with buffers with  inversion and open -collector out 
void GPIB_Read_control()
{
	uint8_t data_ctl;
	 data_ctl=0;
	 //read  , encode 
	if (!(PIND&(1<<PIND2))) { data_ctl|=0x80; }  //EOI, for inv. buff. with open-collector 
	if (!(PINC&(1<<PINC5))) { data_ctl|=0x40; }  //REN  //for inv. buff. with open-collector 
	if (!(PINC&(1<<PINC4))) { data_ctl|=0x20; }  //ATN  //for inv. buff. with open-collector 
	if (!(PINC&(1<<PINC3))) { data_ctl|=0x10; }  //SRQ  //for inv. buff. with open-collector 
	if (!(PINC&(1<<PINС2))) { data_ctl|=0x08; }  //IFC  //for inv. buff. with open-collector   
	if((DDRD&(1<<DDD2)) ==0 ) {data_ctl|=0x04; }      //test			
    SendToUART(data_ctl);		
		
}

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Check for other projects    . 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Check for other projects    . 

Such as??  Why post one sentence at time (#2, 5,6, 11,14,22,29,30,31,38, 41,43,45 and others) ?  Some of them don't say anything at all (#5,#6,#22) That is rather uninformative, rather than being an actual post for discussion.  Is this just a means to use the platform as a notebook? Are you hoping to discuss? 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fixed bug with TE  line  in the  circuit_control_all_noninvbuff_0.jpg   (it was reloaded ). Fixed bug wit IFC (PINC2 is  not a PIND3  for PORTC ). 

Button "DIO?" and command "$7" ( for  data bus  statement  monitoring   if acceptor is a talker(sets DB )  , but with hong )     for uart use only for reading data statement from bus (without handshake, DB  buffer is in the  'read' mode , not use with  "#db" command (for controller  : talker-> listener )    ). You can add  two switches  for SRQ,EOI bus for debug  . 

 

For command  "$9"


0xfc,252  dec: EOI=1  no ,  REN=1  no , ATN=1 no ,  SRQ=1 no  ,  IFC =1 no  ,  DDD2 is input?   1= yes      , 00
0xbc,188  dec:  EOI=1  no ,  REN=0 active , ATN=1 no ,  SRQ=1 no  ,  IFC =1 no  ,  DDD2 is input?   1= yes      , 00
0xdc, 220  dec:  EOI=1  no ,  REN=1 no , ATN=0 active ,  SRQ=1 no  ,  IFC =1 no  ,  DDD2 is input?   1= yes      , 00
0x9c, 156  dec:  EOI=1  no ,  REN=0 active , ATN=0 active ,  SRQ=1 no  ,  IFC =1 no  ,  DDD2 is input?   1= yes      , 00
60   dec:  EOI=0  active ,  REN=0 active , ATN=1 no ,  SRQ=1 no  ,  IFC =1 no  ,  DDD2 is input?   1= yes      , 00
28    dec:  EOI=0  active ,  REN=0 active , ATN=0 active ,  SRQ=1 no  ,  IFC =1 no  ,  DDD2 is input?   1= yes      , 00
140    dec:  EOI=1  no,  REN=0 active , ATN=0 active ,  SRQ=0 active  ,  IFC =1 no  ,  DDD2 is input?   1= yes      , 00
12     dec:  EOI=0  active,  REN=0 active , ATN=0 active ,  SRQ=0  active  ,  IFC =1 no  ,  DDD2 is input?   1= yes      , 00
148    dec:  EOI=1  no,  REN=0 active , ATN=0 active ,  SRQ=1  no  ,  IFC =0 active  ,  DDD2 is input?   1= yes      , 00
Commands for GUI buttons
REN
$1$9(answ. byte ctl ); ($0$9(answ. byte ctl )) REN
IFC
$4$9(answ. byte ctl )  IFC
IDY
$6$9(answ. byte ctl ) ($5$9(answ. byte ctl )) IDY 
ATN
$3$9(answ. byte ctl ) ($2$9(answ. byte ctl )) ATN

Send command  (0x01 GTL , DB is output ) 
$3$9 (answ. byte ctl )    (set ATN=low )    
#'\x01' (answ.  0x02/0x03 )
$9   (answ. byte ctl )

Send DB
#'\x01'    (answ.  0x02/0x03 )
$9 (answ. byte ctl )

Read DB ( set DB as input )
$8   (answ. byte DB HS)
$9   (answ. byte ctl )
DIO?
$7 (answ. read byte DB from DIO ( no HS ) , buffer  =input )
$9 (answ. byte ctl )
Check Statement 
$9(answ. byte ctl )

Send string "12"
    $5$9 (answ. byte ctl )    
    $2$9 (answ. byte ctl )
     #'1'   (answ.  0x02/0x03 )
      $9 (answ. byte ctl )
     #'2'   (answ.  0x02/0x03 )
      $9 (answ. byte ctl )
 ...
wait EOI/SRQ low    
Read 
   $2$9 (answ. byte ctl )
   $8(answ. byte DB HS)
   $9   (answ. byte ctl ) 
   $8(answ. byte DB HS)
   $9   (answ. byte ctl ) 
 ...
wait EOI/SRQ low   

 

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

I'm still looking for the "simple" part in the title of this OP

 

 

Jim

 

 

Controller is  a simple controller  (without full NI488.2 commands decoder), because  NI488.2    commands  and  decoder  are not implemented (for  NI488.1 and for manual control    ).  Invertor in this circuit is abstract ( default settings in the simulator, may be with OC+ resistor. )  . 

Last Edited: Thu. Dec 30, 2021 - 10:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Check for other projects   

 

 

For gpibtool_allnoninv_OC,gpibtool_inv_buffs_OC,gpibtool_noninvDB ( folders).

Last Edited: Thu. Dec 30, 2021 - 10:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is possible to add the '$d' and other options (commands)  for reading data via USART  from MCU latches  for DB sending (not for reading , in TE=0 mode, ( from  PINx or PORTx (?) , but  it is necessary for  checking sended data byte for  '#byte' command   ) ). It may be used  in the alternative  manual GPIB terminal  program for bus  statement checking (to the "LEDs")   ( GUI example in the attach , but now this progams  is with bugs ).    

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

 ( GUI example in the attach , but now this progams  is with bugs ). 

Well, your next dozen posts should clear that up crying  Do you realize you already had to post 14 notices/corrections already, just today??

 

Seriously, why don't you get everything ready and working then post the thing?  Nobody is going to traipse through 50 offbeat posts to guess what is happening so far.

You might be creating a great solution, but it won't seem that way.

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it  necessary to use  read string (via handshake) in the ATN=low ?  

 

For IDY=1   (for STB) use  DIO? (for $7 ).  Is this correct ? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
void SetStrDIO1( HWND  Dlg, int x)
{

char str1[9]={0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0  };
//itoa (i, p, 16);
//if(IsDlgButtonChecked(Dlg, IDC_OCT)) { sprintf(str1,"%0.3o",(int)Byte); SetDlgItemText(Dlg,IDC_DIO_IND , str1); }
//if(IsDlgButtonChecked(Dlg, IDC_HEX)) { sprintf(str1,"0x%0.2X",(int)Byte); SetDlgItemText(Dlg,IDC_DIO_IND , str1);  } 

 if (outmode==2){  sprintf(str1,"0o%0.3o",(int) x);  }
 if (outmode==1){ sprintf(str1,"0x%0.2X",(int)x); }
if (outmode==0) {
 ((unsigned char)x&0x80) ? str1[0]= '1' :  str1[0]= '0'  ;
 ((unsigned char)x&0x40) ? str1[1]= '1' :  str1[1]= '0'  ;
  ((unsigned char)x&0x20) ?str1[2]= '1' :   str1[2]= '0'  ;
 ((unsigned char)x&0x10) ? str1[3]= '1' :  str1[3]= '0'  ;
 ((unsigned char)x&0x08) ? str1[4]= '1' :  str1[4]= '0'  ;
 ((unsigned char)x&0x04) ? str1[5]= '1' :  str1[5]= '0'  ;
 ((unsigned char)x&0x02) ? str1[6]= '1' :  str1[6]= '0'  ;
 ((unsigned char)x&0x01) ? str1[7]= '1' :  str1[7]= '0'  ;
}

Added a subroutine  for  binary and octal  DB output  and  a version with manually controlled ATN=1  for  reading DB strings  (for debug some tools ). Default   ATN=0 when read string (autoexit into the data mode, wait EOI or SRQ  active (low) ). 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

About buffers : Newnes Radio and Electronics Engineers Pocket Book by Keith Brindley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

About decoding of the some commands  (with ++  or  * , using decoder    )  : http://www.dalton.ax/gpib/code/index.shtml    ,  http://www.dalton.ax/gpib/           ( Prologix_cmd.c , if use buffers with  open-collector output  or with diodes ) .

Last Edited: Sat. Jan 1, 2022 - 05:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

About buffers : Newnes Radio and Electronics Engineers Pocket Book by Keith Brindley

That's beyond wonderful, but do you need an entirely separate post just to say so?  You can edit something and simply add this, in a meaningful way. 

Nobody is going to read your posts one sentence at a time, especially once you get to 57, since that is reserved for ketchup only.   The link in #55 doesn't  even work.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rpz3598 wrote:

About decoding of the some commands  (with ++  or  * , using decoder    )  : http://www.dalton.ax/gpib/code/index.shtml    ,  http://www.dalton.ax/gpib/           ( Prologix_cmd.c , if use buffers with  open-collector output  or with diodes ) .

 

Fixed URL problem 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://g2pc1.bu.edu/~qzpeng/gpib/manual/GpibProgTut.pdf   about     Status Byte registers (STB ("БСТ")  , DIO1-4, DIO5,DIO6,DIO8        and SRE   )         and  RQS  (bit6 ,DIO7 ,"ОБЗ"),  User Request  bit.

Last Edited: Sat. Jan 1, 2022 - 11:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This #58  link is extremely informative and very good to read & good to have as an intro.  But you should add it to your first post, so people can read the intro concepts description at the beginning, not 58 posts later.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is possible  to add  a combobox for    S,P,D  for PPE = 0x60 |  (S<<3) | (P=0x00...0x07)   , and for PPD =0x70| D,   with D= (0x00-0x0f) . Now this i an address GPIB combobox   0-15 as a digit. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

My program with modifyed GUI for PPE,PPD 

 

Fixed ATN label string control for IDY=0/1, now with versions  for debug without additional messages and  withhout timeout  messages.  

Attachment(s): 

Last Edited: Mon. Jan 3, 2022 - 08:04 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is this code  correct  for sending  last  DAB (when ATN=high,0)  with EOI=1 (low )  if  not use EOS  (CR LF)    ?

/*$0 REN=0 (set REN high )
$1 REN=1 (set REN low )
$2 ATN=0 (set ATN high )
$3 ATN=1 (set ATN low )
$4 IFC=1 pulse (pulse IFC  low 13.2 ms )
$5 IDY=0 , turn off parallel poll   (EOI  in , ATN high)
$6 IDY=1 , turn on parallel poll   (EOI  out , ATN and EOI low )
$7 Read Data bus statement   (transmit via RS232    DIO1-DIO8  statement  byte (status))
$8 Receive byte via GPIB HS (receive  byte from GPIB with handshake  and send to UART or  send error 0x01 )
$9 Read control lines (send  byte with EOI,REN,ATN,SRQ,1,IDY, 0,0 statement)
#x Send ASCII -code via GPIB HS (Transmit byte x using handshake and send report to UART :0x03 success , 0x02 error)
&x Send ASCII -code via GPIB HS  with EOI=1 (low,output)   . Transmit byte x using handshake and send report to UART :0x03 success , 0x02 error 
 $d read DB latches (for send ) without hs and TE chang. 
 $t  if TE=1  sends  'T' (0x54), if TE=0 sends  'L'(0x4c)
 $e Set EOI =1 (low), output ( without ATN=1 )
 $n Set EOI =0 (high), input ( without ATN=0 changing )
*/
void GPIB_SendByte_HS ( uint8_t  tx_byte)
{
SetDBOut();
SetNRFD_NDAC_In() ;  //in the acceptor check NRFD=1 NL , NDAC =1 NL , then NRFD=0 NL
SetDavHigh();
//if   NRFD =0 NL, high  and   NDAC=0 NL,  high  then error
while (Check_NRFD_and_NDAC_high())    // NRFD must be  high, NRFD=0 NL   if ready
{
 CheckTimeoutNRFD_and_NDAC_high();
 if ( Check_NRFD_and_NDAC_high()) {  SetDavHigh(); SendToUART(0x02); return;	}
 }
Out_DAB_to_bus (tx_byte);

//NRFD=0 NL,  High ? No -loop,      yes -next
//NRFD=1 NL,  low ? yes -loop,      no -next 

//Loop is for circuit with buffer  NRFD with inverted  OC output
  while (CheckNRFD_low()) {   ;}
  SetDavLow(); 

//NDAC =0 NL, High ? If not (if low )-loop, if yes( High ) -next
//NDAC =1 NL, Low ? If yes (if low(  NDAC TTL=1) )-loop, if no( High ) -next
//for circuit with buffer  NDAC with inverted   output  with open collector 

while ( CheckNDAC_low() )     {   ; }
//if success
  SetDavHigh();
  SendToUART(0x03);
return ;
}

void GPIB_SendByte_HS_EOI_low( uint8_t  tx_byte)
{
SetDBOut();
SetNRFD_NDAC_In() ;  //in the acceptor check NRFD=1 NL , NDAC =1 NL , then NRFD=0 NL
SetDavHigh();
//if   NRFD =0 NL, high  and   NDAC=0 NL,  high  then error
while (Check_NRFD_and_NDAC_high())    // NRFD must be  high, NRFD=0 NL   if ready
{
 CheckTimeoutNRFD_and_NDAC_high();
 if ( Check_NRFD_and_NDAC_high()) {  SetDavHigh(); SendToUART(0x02); return;	}
 }
Out_DAB_to_bus (tx_byte);
Set_EOI_out_low();   // used  for  set EOI low with DAB ( when  IDY=0, ATN=0 , data)
//NRFD=0 NL,  High ? No -loop,      yes -next
//NRFD=1 NL,  low ? yes -loop,      no -next 

//Loop is for circuit with buffer  NRFD with inverted  OC output
  while (CheckNRFD_low()) {   ;}
  SetDavLow(); 

//NDAC =0 NL, High ? If not (if low )-loop, if yes( High ) -next
//NDAC =1 NL, Low ? If yes (if low(  NDAC TTL=1) )-loop, if no( High ) -next
//for circuit with buffer  NDAC with inverted   output  with open collector 

while ( CheckNDAC_low() )     {   ; }
//if success
  SetDavHigh();
  SendToUART(0x03);
return ;
}
...
 uint8_t arg=0;

ISR(USART_RXC_vect)
{
cli();
uint8_t uart_byte;
uart_byte=UART_receive();
switch(arg)
{
case '#' :
             GPIB_SendByte_HS(uart_byte);
             arg=0;
             break;

case '&' :
           GPIB_SendByte_HS_EOI_low(uart_byte);
             arg=0;
             break;
case '$' :
              switch(uart_byte){
                case '0' :
                             Set_REN_High(); //Set REN=0 NL
                             break;
                case '1' :
                             Set_REN_Low(); //Set REN=1 NL
                             break;
               case  '2' :
                              Set_ATN_High(); //Set ATN=0 NL, data mode
                              break;
               case  '3' :
                             Set_ATN_Low();  //Set ATN=1  NL , command mode
                             break;
               case  '4' :
                             Send_IFC_Low_Pulse();  //IFC =1 pulse  ,   low , 14 ms
                             break;
                case  'c' :
                            Set_IFC_Low_manual();  //IFC =1 low manual
                             break;
                 case  'h' :
                             Set_IFC_High_manual();  //IFC =0 high manual
                             break;
               case  '5' :
                             Set_IDY_0();   //mode IDY=0 turn off parallel polling, EOI in,  ATN out,  high , default
                             break;
               case '6' :
                             Set_IDY_1();   //mode IDY=1 turn on parallel polling , EOI out , EOI =1(out) ,  ATN=1 (out)
                             break;
                case '7' :
                             GPIB_Read_DB_Statement(); // Read byte from GPIB
                             break;
               case '8' :
                             GPIB_Receive_byte_HS();  //Receive byte    from GPIB  (HS)
                              break;
              case '9' :
                              GPIB_Read_control(); // Read control lines from GPIB
                              break;
               case 'd' :
                              GPIB_Read_DBforOut(); // Read DB latches for DB out
                               break;
               case  't':
                            GPIB_GetControllerTakerMode();
                           break;

             case  'e' :
                             Set_EOI_out_low();
                             break;

             case  'n' :
                             Set_EOI_input();
                             break;

              default :
                             break;
             }
             arg=0; //after  2 bytes
             break;

case 0x00:

            if(uart_byte=='#') { arg=uart_byte;   }   //if first byte is for send  data HS , wait for second byte
             if(uart_byte=='&') { arg=uart_byte;   }   //if first byte is for send  data HS , wait for second byte
            if(uart_byte=='$') { arg=uart_byte;   }   //if first byte is  a  command  , wait for second byte 

           break;

default :
           arg=0;   //reset
           break; 

}

asm("sei");

return;

}

 

 

Last Edited: Mon. Jan 3, 2022 - 11:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My modifyed  editiond and  snapshots  with EOI control functions (    "$e", "&byte_for_hs", "$n"  , may  be with auto switching to the selected  mode  if mode was set successful  )  : with default edition ,  without timeouts, without srq messages  . 

Attachment(s): 

Last Edited: Tue. Jan 4, 2022 - 05:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

An example for  listener ,AH ( check program data  with com0com and Termite for emulation ):

/*
Byte after $9

0xfc,252  dec: EOI=1  no ,  REN=1  no , ATN=1 no ,  SRQ=1 no ;  IFC =1 no  ,  (DDD2 is input?)   1= yes , 00        

0xfc    all indicators are turned off
0xbc   REN  (if REN=1)
0xdc   ATN   (if ATN=1)
0xf4   IFC    (if IFC=1)
0x7c   EOI   (if EOI=1 )
0xec   SRQ  (if SRQ=1 )
0xac  REN, SRQ (if request)
0x9c  REN, ATN (if command mode )
0x8c  REN,ATN,SRQ ( if request , but in the command mode , if switch )
0x6c  SRQ,EOI  (if  received SRQ and EOI, other are turned off , if switch  )
0x78  EOI,IDY   (may be after manual EOI=1, but REN=0, ATN=0 )
0x3c  REN,EOI (if last byte)
0x1c  REN, ATN,EOI
0x38  REN,EOI,IDY
0x18  REN,EOI,ATN,IDY (if IDY=1,REN=1 , for button IDY )
0x58  EOI,ATN,IDY (after IDY=1 button )
0x48  EOI,ATN,SRQ,IDY
0x00  EOI,REN,ATN,SRQ,IFC ( port may be closed )

if (byte&0x03)<> 0x00  communication error  

IFC pulse
 $4$9
0xfc
REN=1
 $1$9
0xbc
Send command  MLA 2
 $3#"
0x03
$9
0x9c

Send "A520.1,M15,"

$5$2#A
0x03
$9
0xbc
#5
0x03
$9
0xbc
#2
0x03
$9
0xbc
#0
0x03
$9
0xbc
#.
0x03
$9
0xbc
#1
0x03
$9
0xbc
#,
0x03
$9
0xbc
#M
0x03
$9
0xbc
#1
0x03
$9
0xbc
#5
0x03
$9
0xbc
#,
0x03
$9
0xbc

Send   [Check statement]
 EOI=1(low)
Send   [Check statement]
 EOI=1(low)
Send   [Check statement]
 EOI=1(low)
Set ATN=1(low), commands
Send DB(hs): 0x01   [SOH]
 OK
Set ATN=0(high), data mode
Send  IFC=1 (low)  pulse
Send  IFC=1 (low)  pulse
Set REN=1(low) ,remote
Set ATN=1(low), commands
Send DB(hs): 0x22   "
 OK
Set IDY=0: EOI-input,ATN-high
Set ATN=0(high), data mode
Send DB(hs): 0x41   A
 OK
Send DB(hs): 0x35   5
 OK
Send DB(hs): 0x32   2
 OK
Send DB(hs): 0x30   0
 OK
Send DB(hs): 0x2E   .
 OK
Send DB(hs): 0x31   1
 OK
Send DB(hs): 0x2C   ,
 OK
Send DB(hs): 0x4D   M
 OK
Send DB(hs): 0x31   1
 OK
Send DB(hs): 0x35   5
 OK
Send DB(hs): 0x2C   ,
 OK
*/

 

Last Edited: Tue. Jan 4, 2022 - 07:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For the prototype the sequence for send and read may be   :


$4$9
0xfc
$1$9         ; (REN=1)                                                                   
0xbc         ; (REN )      

For Send "*IDN?\r\n" and read 
                                                             
$3#0x20   ; ( ATN=1, send  MLA   0x20 | addr 0 )                                                                        
0x03           ; hs Ok 
$2#*         ; ATN=0 , send bytes                                                                    
0x03            
#I                                                                         
0x03                                               .               
#D                                                                          
0x03              
#N                                                                           
0x03             
#?                                                                           
0x03              
#0x0d                                                                          
0x03              
#0x0a                                                                         
0x03          ;hs Ok    
$9           ;   check statement                                                                 
0xbc       ; (REN )
         
$3#0x40     ; ( ATN=1, send  MTA   0x40 | addr 0 )                                                                       
0xbc              
$2$8                                                                         
0x31            
$8                                                                           
0x32               
$8                                                                           
0x33               
$8                                                                           
0x34            
$8                                                                          
0x0d        (last byte , with EOI=1)         
$8                                                                           
0x0a       (received EOI, REN=1,ATN=0,SRQ=0)        
$9                                                                         
0x3c     (REN=1, EOI=1)

"1234" (for  0x0d and 0x0a)
*****************

For Send:
$3#0x20                                                                          
0x03           
$2#*                                                                           
0x03              
#I                                                                              
0x03              
#D                                                                           
0x03            
#N                                                                           
0x03             
#?                                                                           
0x03               
#0x0d                                                             
0x03              
#0x0a                                                                       
0x03               
$9                                                                           
0xbc    (REN=1)       
                                                 
******************
$1$9   (REN=1)  

For read:                                                                     
0xbc                                                                 
$3#0x40   (MTA 0x40|addr 0 )      
                                                                 
0x03             
$2$8        (ATN=0, read DABs)                                                                  
0x40 '@'   // may be for STB 0x40, 100 oct               
$8                                                                              
0x31             
$8                                                                         
0x32              
$8                                                                         
0x33             
$8                                                                               
0x65         
$8                                                                             
0x6e          
$8                                                                           
0x64              
$8                                                                         
0x0d            [0x0d]      
$8                                                                           
0x0a            [0x0a with EOI ]      
$9                                                                               
3c   (EOI=1)  


"@123end"
       
                  0x0d, 0x0a,0d+0a,   on  EOI
                  0x0d, 0x0a,0d+0a,   on  EOI                

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is possible to  add the menu with delimitters and terminating rules  for reading  "0x0d", "0x0a", "0x0d+0x0a", "on EOI=1"   and   check EOI  after every byte for " Read string" , terminating  rule  "on EOI=1"  (end of reading if  EOI=1)  . 

May be  a problem with a size of the application for small notebooks.    With   https://docs.microsoft.com/en-us/windows/win32/controls/tab-controls?redirectedfrom=MSDN  not now.  

   

Attachment(s): 

Last Edited: Tue. Jan 4, 2022 - 11:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is possible to  add the menu with delimitters 0x0d, 0x0a, 0x0d+0x0a   and  check EOI after every byte for adding "on EOI=1" delimitter .     

So what??? Do you think someone is going to read 70 posts to figure out what you are doing?   

Maybe you are having lots of troubles getting bugs out & things progressively figured out, but that is the reason to get it finished first.

do you need a notepad?

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Personally, if I wanted to document progress on a project like this (a "blog" if you will?), I'd put the project itself in a repo on Github and then use one of Github's many additional facilities (a wiki available for each repo) to then document my progress/research. Either that or simply allow the check-in log on the repo to document how the repo code developed.

 

Github also allows for your own (per account not per repo) entire githubio Web site. You could use that (free!) we space to document pretty much anything you like. (just add a blog section as a sub section or whatever) 

Last Edited: Wed. Jan 5, 2022 - 01:46 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now with alternative build with tabs (may be with bugs ).  It may be  with simple GPIB analyzer tab  (for  tab[2],    not now).  Is it necessary  to add UNT(0x05 with ATN=1) before MLA  for Send/read data bytes ?  Not  for github ( not ready for it ). 

 

 

Attachment(s): 

Last Edited: Sat. Jan 22, 2022 - 12:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Not  for github. 

What do you mean--are you not familiar with it? --it is easy to set up.  The forum postings are for actual discussions, they are not github for file storage. 

Have you been discussing with anyone?

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rpz3598 wrote:
Not  for github

Why not?

 

As the others have said, that would be a far more appropriate place.

 

If you have something against GitHub specifically, other hosting platforms are available; eg, GitLab, despite the similar name, is entirely unrelated: https://gitlab.com/

 

avrcandies wrote:
Have you been discussing with anyone?

This whole thread does seem to be a load of answers to questions that nobody's asked ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fix or check some stop problems  with reading SRQ=1 (from device) during the data string reading for option EOI=1,  ( while  not EOI=1  ). It is possible to use multithreads for UART.  Fix some problems with manual stop if  MTA error or rtl=1  then press "read string"   ->  loop problem. Is it necessary to use  split  subroutines with different  "Stop" flag coding    for read and write  for CheckControl for stop if EOI=1 (manual, from other  device, if error )?

 

 


DWORD WINAPI SecondThread(LPVOID lpParameter)
{
	//unsigned int& myCounter = *((unsigned int*)lpParameter);
	//while(myCounter < 0xFFFFFFFF) ++myCounter; , from the  example 

//  MessageBox(0, "  Thread  ! ", lpProjName, MB_OK);
//fix
while(hThread != INVALID_HANDLE_VALUE)
{
//put  subroutines here
// Read( );
//MessageBox(0, "Event ", lpProjName, MB_OK);
//SetStrDIO(NULL, (byte)(Counter&0xff)  );
//Sleep(500);
//Counter++;
//if (Counter>100) {Counter=0;}
}

	return 0;
}

void Thread()
{
hThread = CreateThread(NULL, 0, SecondThread, &Counter  , 0, &dwThreadId );
 WaitForSingleObject(hThread, 5000);  //fix
 CloseHandle(hThread); //fix in the other subroutines
}
 
void CheckControlRX(HWND  Dlg)
{
//EOI,REN,ATN,SRQ,1,IDY, 0,0
PurgeComm(port,PURGE_TXCLEAR|PURGE_RXCLEAR);
WriteByte('$');  WriteByte('9');
byte Ctl=ReadByte( );
PurgeComm(port,PURGE_TXCLEAR|PURGE_RXCLEAR);
 if(((Ctl&0x02)!=0) ||((Ctl&0x01)!=0) ){  MessageBox(Dlg, "UART or  controller error  !", lpProjName, MB_OK);  return;  }
 if((Ctl&0x80)==0) { SetLedEOI(  Dlg,1); Stop=1;   }  else    { SetLedEOI(  Dlg,0);     }   //EOI   , 1 if EOI High
 if((Ctl&0x40)==0) {     SetLedREN(  Dlg,1);   }  else    { REN=0;  SetLedREN(  Dlg,0); Stop=1;     }  //REN  //for inv. buff. with open-collector
 if((Ctl&0x20)==0) {     SetLedATN(  Dlg,1); Stop=1;    }  else    { SetLedATN(  Dlg,0);   }  //ATN  //for inv. buff. with open-collector
 if((Ctl&0x10)==0) { SetLedSRQ(  Dlg,1); /* Stop=1;*/ }  else    { SetLedSRQ(  Dlg,0); } //SRQ  //for inv. buff. with open-collector
 if((Ctl&0x08)==0) { SetLedIFC(  Dlg,1);   Stop=1; }  else    { SetLedIFC(  Dlg,0); } //IFC  //for inv. buff. with open-collector
 if((Ctl&0x04)==0) { SetLedIDY(  Dlg,1);   Stop=1;  } else {  SetLedIDY(  Dlg,0);    } //  =1  if IDY=0,  if DDD2=0(EOI inpit , IDY=0 )
SetDlgItemText(Dlg, IDC_STATUS,  "Statement of the control lines was updated " );
UpdateWindow(Dlg);
}

 

It is possible to use additional direction control  pin for  SRQ=1 (as  in the circuit for EOI ), out  mode (using "$r" and  "$q" or alternative codes ) only in the  ATMEGA8A-AU(TQFP)  or  in the  project with ATMEGA16A-PU/AU  ( with split ports for  input and  output with buffers ,    but now it is not ready  ). 

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Too bad, you should have had these errors corrected 2 or 3 weeks ago.  Some have already made their decisions accordingly.

When it rains, it pours.

but now it is not ready 

 This kind of delay is not unduly indispensable without any such notice.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simple controller emulation tool -stub for testing host program (may be modifyed ) . Using with null-modem -emulator, 115200 , 8N1 , COM6 to COM7 . 

It is necessary to add  a  stop    mode  on  0x01 (or change the hex) from the controller when reading string , reallocate or remove  the comments  for SRQ  . 

May be with some problems with IDY (may be fixed in the i/o protocol ).  

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Creating of  the controller  with SRQ direction control (nDLSRQ) on the ATMEGA8A-AU(TQFP) may be wery  difficult without a register (PB6/PB7 are on the  XTAL (for UART ),  PC6  on the nReset   ).  For ATMEGA16A  it is easy. 

Attachment(s): 

Last Edited: Thu. Jan 27, 2022 - 11:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

This is  a one of the prototypes of the circuits  with ATMEGA16A-PU(or ATMEGA16A-AU  ). For debug . 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

An alternative tool with ATMEGA16A and remapped  ports PA,PC,PB  for  more optimal displacement  of the drivers (74LS38 ):

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

 Not  for github ( not ready for it ). 

What do you mean by that ?  

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

 Not  for github ( not ready for it ). 

What do you mean by that ?  

What indeed?!

 

See also #73

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My alternative projects for ATMEGA16A  (found some  problems when switching after  Send (not reply , may be   a problem with loop NRFD,NDAC timeouts loops  linking  ) to read , check DB  and then to send   ( baudrate or  fix some problems ) ). 

Fixed . 

 

It may be because this tool was temporary tested without buffers (NRFD,NDAC  for send  ,  manually checked PD5 to ground , then PD6 to ground , it may work , answer 0x03, Ok  ).

 

 

Renamed IDY to  EOI out (IDY statement check by EOI ,ATN and EOI out  indicators )  .

Attachment(s): 

Last Edited: Fri. Jan 28, 2022 - 06:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies, awneil...

No avail.
He is in his armoured vehicle, most of the time unaware of anything.
For how long?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

A  PCB   prototype   for   the model of the tool with ATMEGA16A,74LS38 , buffers , ST232N.  IEEE488  socket  (  CN24F ) pinouts  in the attach. 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


You should think of using wirewrap, you would have better luck.   It is perfect for logic chips

https://www.nutsvolts.com/magazi...

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

grohote wrote:
He is in his armoured vehicle, most of the time unaware of anything

certainly seems to be in write-only mode... frown

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The loops CheckDavLow , CheckDavHigh  in the  RX byte  via HS  subroutine  may be with some  problems  ( slow or not  wery compatible with HS algorithm  , but with timeouts , change  ). But it is a problem with this loops (if no timeout procedures) if MTA error  or  "rtl" occured in the Talker. In the assembler edition it may be fixed . 

Last Edited: Wed. Feb 2, 2022 - 11:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

I cannot help thinking that at this stage you are simply taking the piss out of avrfreaks.net? What possible purpose does this thread serve apart from your own interests? Why are you hosting this here rather than on your own blog/wiki? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Because this is a forum about the AVR  processors and  appilcation   and  progamm methods  for  this processors .  This edirtion of the project   for non-commercial using . 

The assembler edition  for ATMEGA16A  is  in the developement . Asserting and deasserting  of the REN,IFC,ATN,EOI,IDY   works ( I test edition 4 for ATMEGA16A, all buffers with invertors ). 

For handshake subroutines   it is necessary to use  some fixings for loops and timeouts  (more optimal it can be created  using the assembler edition, for STM cips this is a problem  ).  

Last Edited: Thu. Feb 3, 2022 - 06:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Because this is a forum about the AVR  processors and  appilcation   and  progamm methods  for  this processors .  This edirtion of the project   for non-commercial using . 

The assembler edition   is  in developement.

So what?--That sounds mostly like a bunch of incoherent & meaningless nonsense.  This is just plain foolish to have all of these incoherent updates full of errors going on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on  ...like maybe the forum is just some sort of hard drive to keep your documents??  No, it is for discussions.  This is why you have github and other such sites to capture your ongoing development. 

Who's going to wade through all these numerous updates? You are doing nobody any favor in this manner.  This is not to say you are not investing time and effort to make something that might be useful, however it is not useful presented in this manner.  

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A subroutine with runtime DAV checking, but with timeout (approx 100 ms).


GPIB_Receive_byte_HS:

call  SetDBIn ;

call SetNRFD_NDAC_Out ; 
call Set_NDAC_Low;  preset the default  NDAC 
call Set_NRFD_High;  deassert NRFD for  the acceptor (listener) ready statement 
; check DAV low ? No - loop, Yes- next  (DAV high ? Yes - loop, No - next)
; for buffers with invertors 

; Timeout delay 737 280  cycles ( fix for append with  sbic lines )
; 100ms at 7.3728 MHz
; load delay values 
    ldi  r20, 4       
    ldi  r21, 190    
    ldi  r22, 126     ; fix

Check_DAV_LOW:   ; DAV low ? no (is high, PB7=0 ) - loop, yes(PB7=1)- next 
   sbic PINB, PINB7 ;  
   jmp AcceptData  ; terninate from loop  if  DAV is  low (PB7=1)
    dec  r22
    brne Check_DAV_LOW
    dec  r21
    brne Check_DAV_LOW
    dec  r20
    brne Check_DAV_LOW

    call SendErrorRXMSG;  exit with error 0x01 after the timeout
    ret
AcceptData:
; set NRFD=1 NL, low
call Set_NRFD_Low; //assert the NRFD 

; accept data byte
call In_DAB_from_bus ;     
; Set NDAC=0 NL,  high 
call Set_NDAC_High ; //deassert NDAC
; check DAV=0 NL (high)  No-loop ,  yes-next 
; for buffers with invertors 
Check_DAV_High: ; DAV high ? no (is low, PB7=1) - loop, yes(PB7=0)- next 
sbic PINB, PINB7 ;  
jmp Check_DAV_High   ; may be with timeouts
 
mov r16, r19
 call SendToUART;
; set  NDAC=1  (  low , for bus)
 call Set_NDAC_Low;
 ret;

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Modifyed subroutines for send data via HS:


 ; send byte via handshake alg. 
GPIB_SendByte_HS :     ;  uint8_t  tx_byte in the r24
call SetDBOut; 
call SetNRFD_NDAC_In ; in the acceptor check NRFD=1 NL , NDAC =1 NL , then NRFD=0 NL
call SetDavHigh;
;  if   NRFD =0 NL, high  and   NDAC=0 NL,  high  then error     
;  NRFD must be  high, NRFD=0 NL   if ready         
; Timeout Delay 737 280 cycles
; approx 100ms at 7.3728 MHz
    ldi  r20, 4
    ldi  r21, 190
    ldi  r22, 126 ; fix 
Check_NRFD_and_NDAC_high: ; if PB6=0 and PB5=0 (NRFD and NDAC are high , both )   terminate with error 
   in r16, PINB
   andi r16, ((1<<PINB6)|(1<<PINB5));
   cpi  r16, 0x00
   brne SendIsPossible
   dec  r22
   brne Check_NRFD_and_NDAC_high
   dec  r21
   brne Check_NRFD_and_NDAC_high
   dec  r20
   brne Check_NRFD_and_NDAC_high

    ExitWithError:
    call SetDavHigh; 
    ldi r16, 0x02
    call SendToUART ; 
    ret;	
 
SendIsPossible:
   call Out_DAB_to_bus ; (tx_byte  in the  r24);
; NRFD=0 NL,  High ? No -loop,      yes -next 
; NRFD=1 NL,  low ?  yes -loop,      no -next 
; Loop is for circuit with NRFD buffer with inverted  OC output  
; for  buffers with invertors  and OC
CheckNRFD_low:   
   sbic PINB, PINB5 ; if PINB5<>0, loop 
   jmp CheckNRFD_low ; skip this line  if NRFD=high  (PINB5=0)

   call  SetDavLow; 

 ; NDAC =0 NL, High ? If not (if low )-loop, if yes( High ) -next  
 ; NDAC =1 NL, Low ? If yes (if low(  NDAC TTL=1) )-loop, if no( High ) -next  
 ; for circuit with buffer  NDAC with inverted   output  with open collector 
 
CheckNDAC_low:  ;  for  buffers with invertors and OC 
   sbic PINB, PINB6 ; if  PINB6<>0 then loop 
   jmp CheckNDAC_low ; skip this line  if NDAC=high  (PINB6=0)

 ; if success 
   call  SetDavHigh;
   ldi r16, 0x03
   call  SendToUART ;
   ret ; 


;********************

 ; send byte via handshake alg. with EOI=1  
GPIB_SendByte_HS_EOI_low:    ;  uint8_t  tx_byte in the r24

call SetDBOut; 
call SetNRFD_NDAC_In ; in the acceptor check NRFD=1 NL , NDAC =1 NL , then NRFD=0 NL
call SetDavHigh;
;  if   NRFD =0 NL, high  and   NDAC=0 NL,  high  then error
;  while (Check_NRFD_and_NDAC_high()) {   // NRFD must be  high, NRFD=0 NL   if ready         
;  NRFD must be  high, NRFD=0 NL   if ready         
 
; Timeout Delay 737 280 cycles
; approx  100ms at 7.3728 MHz

    ldi  r20, 4
    ldi  r21, 190
    ldi  r22, 126 ;fix for commands 

Check_NRFD_and_NDAC_high1: ; if PB6=0 and PB5=0    terminate with error 
   in r16, PINB
   andi r16, ((1<<PINB6)|(1<<PINB5));
   cpi  r16, 0x00
   brne SendIsPossible1
   dec  r22
   brne Check_NRFD_and_NDAC_high1
   dec  r21
   brne Check_NRFD_and_NDAC_high1
   dec  r20
   brne Check_NRFD_and_NDAC_high1

   ExitWithError1:
   call SetDavHigh; 
   ldi r16, 0x02
   call SendToUART ; 
   ret;	
 
SendIsPossible1:

  call Out_DAB_to_bus ; (tx_byte  in the  r24);
  call Set_EOI_out_low   ; assert the EOI line  
; NRFD=0 NL,  High ? No -loop,      yes -next 
; NRFD=1 NL,  low ?  yes -loop,      no -next 
 
; Loop is for circuit with buffer  NRFD with inverted  OC output  
; for  buffers with invertors and OC
CheckNRFD_low1:   
  sbic PINB, PINB5 ; if PINB5<>0, loop 
  jmp CheckNRFD_low1; skip this line  if NRFD=high  (PINB5=0)

 call  SetDavLow; 
; NDAC =0 NL, High ? If not (if low )-loop, if yes( High ) -next  
; NDAC =1 NL, Low ? If yes (if low(  NDAC TTL=1) )-loop, if no( High ) -next  
; for circuit with  NDAC buffer  with inverted   output  with open collector 

CheckNDAC_low1:  ; //for  buffers with invertors and OC 
  sbic PINB, PINB6 ; if  PINB6<>0 then loop 
  jmp CheckNDAC_low1; skip this line  if NDAC=high  (PINB6=0)

; if success 
  call  SetDavHigh;
  ldi r16, 0x03
  call  SendToUART ;
  ret ; 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The assembler edition of the program for ATMEGA16A (preview)

Attachment(s): 

Topic locked