搜索
bottom↓
回复: 119

有用过NI 公司NET9914芯片的吗,就是GPIB协议的芯片?

  [复制链接]

出0入0汤圆

发表于 2012-9-17 20:19:44 | 显示全部楼层 |阅读模式
有用过NET9914芯片的朋友吗?我看了它的PDF文档,我不明白里面说的可以有两种模式,即MODE 9914 各MODE 7210模式。到底应该怎么样初始化它啊?是不是两种模式都要进入进行设置呢?有用过的可以讲一下吗?谢谢了!

出0入0汤圆

 楼主| 发表于 2012-9-18 08:27:31 | 显示全部楼层
顶一下,高手们帮我看一下啊!

出0入0汤圆

 楼主| 发表于 2012-9-24 16:27:12 | 显示全部楼层
是不是这个芯片很少人用呢?应该不会呀,比较老的芯片了!我无法让它工作起来,完全按照PDF文档进行初始化的,有哪位朋友用过的么,帮忙讲讲,谢谢了,我都弄了一个星期了!!

出0入0汤圆

发表于 2012-9-24 16:34:34 | 显示全部楼层
我也要用GPIB这个破玩意啊....
一起研究吧...
现在不都是用网卡么...
那一个破芯片赶上整个解决方案了....

出0入0汤圆

 楼主| 发表于 2012-9-24 18:12:49 | 显示全部楼层
adce 发表于 2012-9-24 16:34
我也要用GPIB这个破玩意啊....
一起研究吧...
现在不都是用网卡么...

也是用这个芯片吗?我的问题是根本找不到仪器,按理说应该复位后设置好时钟频率后就能找到了啊,对吧?
我的初始化程序:
我用的是STM32C8,用中断产生2M频率时钟。初始化后判断中断脚,并进行处理。
void init_9410(u8 addrcode)
{         
         init_9914port();
         Reset_9914();
         output(AUXCR,SWRST);                //复位        AUXCR写入一次需要4个周期
         delay_us(5);

/*         output(AUXCR,SW7210);           //进入7210MODE
         delay_us(5);
         output(AUXMR,0X50);      //页进寄存款器
         delay_us(5); */


         output(AUXCR,PIACCR);                //页入ACCR          
         delay_us(5);
         output(ACCR,0X24);                        //设定频率2MHZ          这里先不设置MICR位。这里的ACCR就是隐藏寄存器ICR
         delay_us(5);
         output(AUXCR,CLRPI);
         delay_us(5);
         output(AUXCR,PIEOSR);
         delay_us(5);
         output(EOSR,0X0A);        //设置结束符“0X0A”         回车
         output(AUXCR,CLRPI);
         delay_us(5);
         output(ADR,addrcode);          //        read_address()此处设置地址为0x0a
         output(SPMR,0XAA);         //自动响应串行查询。。。。

         init_int();

         output(AUXCR,SWCRRST);
         delay_us(5);               //清除复位
//         init_int();                            //中断设置
}

出0入0汤圆

发表于 2012-9-27 23:43:10 | 显示全部楼层
你使用什么来找设备的?是使用NI-VISA来自动搜索设备的吗?如果要想用NI-VISA直接搜到设备,设备的接口是要符合488.2规范的。你把NAT9914初始化完成后,还是要继续写协议部分的,就是当搜索设备的时候,你要对电脑发过来的数据包按照488.2协议回包,这样你的设备才能被搜到。

看过一些VISA方面的资料,最近也在看GPIB的东西。

出0入0汤圆

发表于 2012-11-10 22:05:34 | 显示全部楼层
你好,我也在研究NAT9914,能否共同研究?

出0入0汤圆

发表于 2012-11-10 22:05:55 | 显示全部楼层
我的QQ号码是453889678

出0入0汤圆

发表于 2012-11-10 22:07:51 | 显示全部楼层
类似output(SPMR,0XAA);这个写入函数,你怎么实现的?
这个需要看NAT9914的手册,编写函数才行吧        

出0入0汤圆

发表于 2012-11-15 18:54:39 | 显示全部楼层
这两天一直在调试NAT9914,发现有时能读取里面的寄存器的值,有时候又不能,非常困惑,希望有共同爱好的人一起来研究

出0入34汤圆

发表于 2012-11-16 11:00:00 | 显示全部楼层
本帖最后由 xyz543 于 2012-11-16 11:02 编辑

楼主应该是要驱动 NI 的 NAT9914 吧? 我冒着工作不保的风险传给您我们公司商业用的标准驱动代码,希望能带给您学习上的方便.

两个 Void,第一个是初始化的程序,第二个是 NAT9914 中断使用的程序,最后是程序内要使用到的 .h 文件,我能提供的也就这么多了.

P.S. 这 NAT9914 是使用于 24 MHz 的晶震! 所有的注释我都已移除了,盼您能谅解..
  1. void Init_Gpib(void)
  2. {
  3.         unsigned char temp_uc;
  4.         char temp_zero=0;
  5.        
  6.         GpibAUXCR=GPIB_CHIPRST;
  7.         GpibAUXCR=GPIB_PIACCR;
  8.         GpibACCR=NAT9914_6MHZ;
  9.         GpibAUXCR=GPIB_PIEOSR;
  10.         GpibEOSR=CR;
  11.         GpibAUXCR=GPIB_PIACCR;
  12.         GpibACCR=0x94;
  13.         GpibADR=GpibAddr;
  14.         temp_uc=GpibISR0;
  15.         temp_uc=GpibISR1;
  16.         temp_uc=GpibISR2;
  17.         GpibSPMR=temp_zero;
  18.         GpibAUXCR=GPIB_PIACCR;
  19.         GpibACCR=0xd0;
  20.         GpibAUXCR=GPIB_NVSTDL;
  21.         GpibAUXCR=GPIB_NSTDL;
  22.     GpibPPR=temp_zero;
  23.     GpibAUXCR=GPIB_NHDFE;
  24.     GpibAUXCR=GPIB_NHDFA;
  25.     GpibAUXCR=GPIB_NSHDW;
  26.         GpibIMR0=0x3f;
  27.         GpibIMR1=0x8d;
  28.         GpibACCR=GPIB_PIIMR2;
  29.     GpibIMR2=0xc8;
  30.         temp_uc=GpibDIR;
  31.     GpibCDOR=temp_zero;
  32.     GpibAUXCR=temp_zero;
  33. }

  34. void Gpib_ISR (void) interrupt 0 using 1
  35. {
  36. char temp_c,err;
  37.     EX0=0;
  38.     GpibAUXCR=GPIB_DAI;
  39.     GpibIsr0Reg|=GpibISR0;
  40.     GpibIsr1Reg|=GpibISR1;
  41.     GpibIsr2Reg|=GpibISR2;
  42.     if(GpibADSR&GPIB_LA){
  43.          GpibIsr0Reg&=(~GPIB_BO);
  44.     }                          
  45.         GpibAUXCR=GPIB_DAI;
  46.     if(GpibIsr0Reg&GPIB_INT0){
  47.         GpibIsr0Reg&=(~GPIB_INT0);
  48.         while(1){
  49.                 if(GpibIsr0Reg&GPIB_BI){      
  50.                     GpibIsr0Reg&=(~GPIB_BI);
  51.                     temp_c=GpibDIR;
  52.                     if(GpibIsr0Reg&GPIB_END){
  53.                         GpibIsr0Reg&=(~GPIB_END);
  54.                         if(temp_c==LF){
  55.                             GpibPutRxChar(temp_c);
  56.                         }
  57.                         else if(temp_c==CR){
  58.                             GpibPutRxChar(temp_c);
  59.                         }
  60.                         else{
  61.                             GpibPutRxChar(temp_c);
  62.                         }   
  63.                     }
  64.                     else{
  65. //                        GpibPutRxChar(temp_c);
  66.                                 }
  67.                 GpibIsr0Reg|=GpibISR0;
  68.                 }
  69.             else
  70.                 break;
  71.         }
  72.         if(GpibADSR&GPIB_TA){
  73.         }
  74.         while(1){
  75.                 if(GpibIsr0Reg&GPIB_BO){
  76.                     temp_c=GpibGetTxChar(&err);
  77.                     if(err==COMM_NO_ERR){
  78.                         if(IOBufTxCtr==0){
  79.                             GpibAUXCR=GPIB_FEOI;
  80.                         GpibTxFlag=0;
  81.                                         }
  82.                     GpibIsr0Reg&=(~GPIB_BO);
  83.                                         GpibCDOR=temp_c;
  84.                     GpibIsr0Reg|=GpibISR0;
  85.                     }   
  86.                     else
  87.                                         break;
  88.                         }
  89.             else
  90.         }
  91.         if(GpibIsr0Reg&GPIB_RLC){
  92.             GpibIsr0Reg&=(~GPIB_RLC);
  93.             if((GpibADSR&GPIB_REM)==GPIB_REM){
  94.             }
  95.         }
  96.         if(GpibIsr0Reg&GPIB_MAC){
  97.             GpibIsr0Reg&=(~GPIB_MAC);
  98.         }
  99.     }
  100.     if(GpibIsr0Reg&GPIB_INT1){
  101.         GpibIsr1Reg&=(~GPIB_INT1);         
  102.         if(GpibIsr1Reg&GPIB_GET){
  103.             GpibIsr1Reg&=(~GPIB_GET);
  104.             GpibAUXCR=GPIB_NRDAC;
  105.         }        
  106.         if(GpibIsr1Reg&GPIB_ERR){
  107.             GpibIsr1Reg&=(~GPIB_ERR);
  108.             GpibAUXCR=GPIB_NBAF;
  109.         }      
  110.         if(GpibIsr1Reg&GPIB_DCAS){
  111.             GpibAUXCR=GPIB_RHDF;
  112.             GpibIsr0Reg=0;      
  113.             GpibIsr1Reg=0;
  114.             GpibIsr2Reg=0;
  115.             GpibAUXCR=GPIB_NRDAC;
  116.             GpibStbReg&=~(GPIB_MAV);
  117.         }
  118.         if(GpibIsr1Reg&GPIB_MA){
  119.             GpibIsr1Reg&=(~GPIB_MA);
  120.             GpibAUXCR=GPIB_VRDAC;
  121.         }
  122.                 if(GpibIsr1Reg&GPIB_IFC){
  123.                         GpibIsr1Reg&=(~GPIB_IFC);/
  124.                 }
  125.         }
  126.         if(GpibIsr2Reg&GPIB_STBO){               
  127.                 GpibSPMR=GpibStbReg;
  128.                 GpibStbReg&=(~GPIB_RQS);
  129.         }
  130.         if(GpibIsr2Reg&GPIB_LLOC){               
  131.         }
  132.     if(GpibADSR&GPIB_LA){
  133.         GpibIsr0Reg&=(~GPIB_BO);
  134.     }
  135.     GpibAUXCR=GPIB_NDAI;
  136.     EX0=1;  
  137. }

  138. /*下方是 GPIB 要调用到的 GPIB.H 文件*/

  139. #define IO_GPIB       0x0000

  140. #define GpibISR0      XBYTE[IO_GPIB]
  141. #define GpibIMR0      XBYTE[IO_GPIB]
  142. #define GpibISR1      XBYTE[IO_GPIB+1]
  143. #define GpibIMR1      XBYTE[IO_GPIB+1]
  144. #define GpibADSR      XBYTE[IO_GPIB+2]
  145. #define GpibIMR2      XBYTE[IO_GPIB+2]
  146. #define GpibEOSR      XBYTE[IO_GPIB+2]
  147. #define GpibBCR       XBYTE[IO_GPIB+2]
  148. #define GpibACCR      XBYTE[IO_GPIB+2]
  149. #define GpibBSR       XBYTE[IO_GPIB+3]
  150. #define GpibAUXCR     XBYTE[IO_GPIB+3]
  151. #define GpibISR2      XBYTE[IO_GPIB+4]
  152. #define GpibADR       XBYTE[IO_GPIB+4]
  153. #define GpibSPSR      XBYTE[IO_GPIB+5]
  154. #define GpibSPMR      XBYTE[IO_GPIB+5]
  155. #define GpibCPTR      XBYTE[IO_GPIB+6]
  156. #define GpibPPR       XBYTE[IO_GPIB+6]
  157. #define GpibDIR       XBYTE[IO_GPIB+7]
  158. #define GpibCDOR      XBYTE[IO_GPIB+7]

  159. #define GPIB_SWRST    0x80   
  160. #define GPIB_NSWRST   0x00   
  161. #define GPIB_CHIPRST  0x1c   
  162. #define GPIB_VRDAC    0x81   
  163. #define GPIB_NRDAC    0x01   
  164. #define GPIB_RHDF     0x02   
  165. #define GPIB_HDFA     0x83   
  166. #define GPIB_NHDFA    0x03   
  167. #define GPIB_HDFE     0x84   
  168. #define GPIB_NHDFE    0x04
  169. #define GPIB_NBAF     0x05   
  170. #define GPIB_FEOI     0x08   
  171. #define GPIB_LON      0x89      
  172. #define GPIB_NRSV2    0x18   
  173. #define GPIB_RSV2     0x98   
  174. #define GPIB_SW7210   0x99   
  175. #define GPIB_SW9914   0x15   
  176. #define GPIB_PIEOSR   0x9e   
  177. #define GPIB_PIACCR   0x9f   
  178. #define GPIB_PIIMR2   0x1e   
  179. #define GPIB_NTON     0x0a   
  180. #define GPIB_SRE      0x90   
  181. #define GPIB_NVSTDL   0x17   
  182. #define GPIB_NSTDL    0x15   
  183. #define GPIB_STDL     0x95   
  184. #define GPIB_REQT     0x9a   
  185. #define GPIB_NREQT    0x1a   
  186. #define GPIB_RTL      0x87   
  187. #define GPIB_NRTL     0X07
  188. #define GPIB_SHDW     0x96   
  189. #define GPIB_NSHDW    0X16   
  190. #define GPIB_DAI      0x93   
  191. #define GPIB_NDAI     0X13
  192. #define GPIB_BIIE     0x20
  193. #define GPIB_BOIE     0x10
  194. #define GPIB_ENDIE    0x08
  195. #define GPIB_RLCIE    0x02
  196. #define GPIB_INT0     0x80   
  197. #define GPIB_INT1     0x40  
  198. #define GPIB_BI       0x20  
  199. #define GPIB_BO       0x10  
  200. #define GPIB_END      0x08  
  201. #define GPIB_SPAS     0x04
  202. #define GPIB_RLC      0x02  
  203. #define GPIB_MAC      0x01
  204. #define GPIB_GETIE    0x80
  205. #define GPIB_ERRIE    0x40
  206. #define GPIB_UNCIE    0x20
  207. #define GPIB_APTIE    0x10
  208. #define GPIB_DCASIE   0x08
  209. #define GPIB_MAIEE    0x04
  210. #define GPIB_IFCIE    0x01
  211. #define GPIB_GET      0x80   
  212. #define GPIB_ERR      0x40
  213. #define GPIB_UNC      0x20
  214. #define GPIB_APT      0x10
  215. #define GPIB_DCAS     0x08
  216. #define GPIB_MA       0x04
  217. #define GPIB_SRQ      0x02
  218. #define GPIB_IFC      0x01
  219. #define GPIB_GLINT    0x80
  220. #define GPIB_STBOIE   0x40
  221. #define GPIB_STBO     0x40
  222. #define GPIB_LLOC     0x08
  223. #define GPIB_EEQ      0x04
  224. #define GPIB_MAV      0x10
  225. #define GPIB_ESB      0x20
  226. #define GPIB_RQS      0x40
  227. #define GPIB_MSS      0x40
  228. #define GPIB_TA       0x02
  229. #define GPIB_LA       0x04
  230. #define GPIB_LLO      0x40
  231. #define GPIB_REM      0x80
  232. #define GPIB_REN      0x01
  233. #define GPIB_ADDR     0x01
复制代码
编辑原因: 将繁体字转为简体字,方便阅读..

出0入0汤圆

发表于 2012-11-22 19:51:46 | 显示全部楼层
感谢!
好好学习一下

出0入0汤圆

发表于 2012-11-22 22:55:27 | 显示全部楼层
xyz543:您好,我看了你的代码,中间的一段中断程序,是否有遗漏?此外好多“{”位置是否正确?
能否将这段发一份给我,非常感谢您了,我的邮箱:xxrsharesky@163.com
非常感谢
      

出0入34汤圆

发表于 2012-11-23 09:52:35 | 显示全部楼层
iamlangzi 发表于 2012-11-22 22:55
xyz543:您好,我看了你的代码,中间的一段中断程序,是否有遗漏?此外好多“{”位置是否正确?
能否将这段 ...

空的括号内的程序仅是设置些错误讯息的回应而已,如 i = 1; j = 2 的类似程序,所以我没有必要都给列出来!

另外,您是否已经测试过程序了? 我能提供的也就是这样,这是我能提供的最大的限度了,已包含初始化 NAT9914 及其中断的做法了,相信应该绝对的够您容易上手了!

若您要求完整的源码的话,与其不如您要我来帮您写完您所要的代码好了!! 因为这是商业用代码,一般这代码根本是公司的机密,我能提供这些已经是能直接应用的了吧?!

出0入0汤圆

发表于 2012-11-23 10:34:01 | 显示全部楼层
您好,非常感谢您的回复。能够将这些给大家学习,真是太不容易了!
希望有机会和您多交流!

出0入34汤圆

发表于 2012-11-23 17:15:20 | 显示全部楼层
iamlangzi 发表于 2012-11-23 10:34
您好,非常感谢您的回复。能够将这些给大家学习,真是太不容易了!
希望有机会和您多交流! ...


我已将您要的东西移植到 Keil C51 的工程上了,接下来您得自己学习了.



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

发表于 2012-11-23 21:56:21 | 显示全部楼层
xyz543:感谢您的无私奉献,谢谢!

出0入0汤圆

发表于 2012-11-27 21:45:39 | 显示全部楼层
本帖最后由 iamlangzi 于 2012-11-27 21:53 编辑

//Gpibdev5.c
/*
gpibdevc.c 7/28/97
GPIB DEVICE implementation for a small microcontroller operating in tandem
with a NAT9914 chip. This C code is designed for a microcontroller. It implements a
GPIB voltage query, tare, Group Execute Trigger, and DCAS commands.
At startup, this code initializes the microcontroller and the NAT9914 and then waits
in an idle state until the NAT9914 sends an interrupt. The device interprets the
interrupt and tares, resets, executes on the G.E.T. command, reads the voltage and
stuffs it into a buffer, or outputs the contents of the buffer to the Active GPIB
listener.
read_voltage(), handle_GET_trigger(), and adjust_tare() are device specific and
shown here as stubs. The NAT9914 interrupts the microcontroller for BI, BO, GET,
and SDC/DCL.
*/
/* assert() statements draw attention to internal errors */
/* #include <assert.c> */
#include "avr/io.h"
#define assert(a) {}
#include "gpibdevc.h"
#pragma interrupt_handler route_nat9914_interrupts
#define USING_INTERRUPTS
/* to input and output on a microcontroller, read or write to a memory location
*/
#define inp(io_address) *(unsigned char *)io_address
#define outp(io_address, o_data) *( unsigned char *)io_address = o_data;
/* state variable. one of the following values
idle_state 1
reading_state 2
writing_state 3
*/
u_8 GPIB_state;
/* buffer variables
Index is an offset from the base address of the i/o buffer.
io_buffer is both the GPIB input and output buffer.
*/
u_8 Index;
u_8 io_buffer[BUFFER_SIZE];
/* isr0_byte and isr1_byte hold data from the NAT9914 status registers which has not yet
* been processed.
*/
u_8 isr0_byte;
u_8 isr1_byte;


int main(void) {
initialize_device();
do{
/*
* all non-GPIB device code goes in this loop
*/
//#ifndef USING_INTERRUPTS
route_nat9914_interrupts();
//#endif
}while(1);
}



/*
*
* Initialization routines
*
*
*
*/
void initialize_device(void) {
/* initialization sequences for both the microcontroller and the NAT9914
*/
initialize_microcontroller();
/* initialize software variables before the device begins accepting GPIB commands
*/
Index = 0;
GPIB_state = idle_state;
initialize_NAT9914();
asm("cli");
}
void initialize_microcontroller(){
/* initialize the microcontroller
* ...these are microcontroller defaults
* expanded memory mode (set by hardware pins)
* set clock speed
* set hardware interrupt to match capabilities of nat9914
* disable watchdog
*/
}
void initialize_NAT9914(){
/* this routine initializes the NAT9914 and enables the device to receive commands from
* the GPIB network.
*/
u_8 my_gpib_address;
/* ...Make sure GPIB chip is in 9914 mode.
*/
outp(r7210_auxmr, c7210_sw9914);
/* ...Reset the NAT9914. Logically remove device from the GPIB. The device will
* ignore GPIB activity until it is initialized.
*/
outp(r_auxcr, c_ch_rst);
/* ...clear the status registers.
*/
isr0_byte = 0;
isr1_byte = 0;
/* ...set clock speed
*/
outp(r_accr, f_icr | f_2mhz);
/* ...set T1 delay
*/
outp(r_auxcr, c_vstdl);
/* ...enable interrupts
*/
outp(r_imr0, b_bo_ie | b_bi_ie);
outp(r_imr1, b_dcas_ie | b_get_ie);
#ifndef USING_INTERRUPTS
outp(r_auxcr, c_piimr2);
outp(r_imr2, 0x00); /* clear GLINT bit */
#endif
/* ...configure the NEWLINE character to end incoming and outgoing GPIB messages
*/
outp(r_auxcr, c_pieosr);
outp(r_eosr, NEWLINE);
outp(r_auxcr, c_piaccr);
outp(r_accr, f_accra | b_xeos | b_reos);
/* ...set the GPIB address of the device
*/
my_gpib_address = get_gpib_address();
outp(r_adr, my_gpib_address);
/* ...enable the device to receive data and commands from the GPIB network
*/
outp(r_auxcr, c_nswrst);
}
u_8 get_gpib_address(void){
/* read the GPIB address from DIP switches. This device specific function reads the
* address from a set of DIP switches connected to port D.
*/
u_8 gpib_address;
gpib_address = inp(PORT_D);
/* convert the invalid address, 31(decimal) into 30
*/
if(gpib_address == 31)
gpib_address = 30;
return gpib_address;
}
/*
*
* Handle Interrupt Routines
*
*
*
*/
void route_nat9914_interrupts(void) {
/* route_nat9914_interrupts handles the hardware interrupt from the NAT9914.
* It determines what caused the interrupt and calls the appropriate function.
* If no interrupts are pending, then it does nothing.
*/
/* ...read isr0 and isr1, the values must be saved because the act of reading the bits
* in the registers clears the bits.
*/
isr0_byte = isr0_byte | inp(r_isr0);
isr1_byte = isr1_byte | inp(r_isr1);
/* ...determine the cause of the interrupt and handle it
*/
if (isr0_byte & b_bo) handle_BO_int();
if (isr0_byte & b_bi) handle_BI_int();
if (isr1_byte & b_get) handle_GET_trigger();
if (isr1_byte & b_dcas) handle_DCAS_int();
}
void handle_DCAS_int(void) {
/* This routine resets only the GPIB interface of the device and not
* the device itself. Its primary use is recovering after an error on the GPIB.
* If a GPIB error occurs and the device locks up or appears to hang, the GPIB
* controller can issue the SDC or DCL command and place the device into its idle GPIB
* state, clear its buffers and start over.
*/
/* ...reinitialize variables and buffers
*/
Index = 0;
GPIB_state = idle_state;
outp(r_auxcr, c_rhdf);
isr0_byte = 0x00;
isr1_byte = 0x00;
/* ...update serial poll response byte
*/
clear_status_byte_bits( b_mav |
b_rsv |
error_reading |
error_writing |
error_unknown_command);
/* ...acknowledge command received and processed by releasing DAC holdoff
*/
outp(r_auxcr, c_nonvalid);
}

void handle_BI_int(void) {
/* The Byte In handler reads a byte from the NAT9914 and stores it in the input buffer.
* If the device has not finished writing data from a previous command message, the
* device overwrites the old data and issues an error message to the GPIB controller.
*/
assert( GPIB_state==idle_state ||
GPIB_state==reading_state ||
GPIB_state==writing_state);
assert(Index <= BUFFER_SIZE);
/* ...update the gpib state
*/
if (GPIB_state == idle_state) {
Index = 0;
GPIB_state = reading_state;
}
/* ...if the controller is sending data to the device while the device is trying to
* send data to the controller, set an error flag in the status byte to warn the
* controller.
*/
else if (GPIB_state == writing_state){
clear_status_byte_bits(b_mav);
set_status_byte_bits(b_rsv | error_reading);
GPIB_state = reading_state;
Index = 0;
outp(r_auxcr, c_nbaf);
}
/* read data from the NAT9914 into the input buffer. To improve performance loop
* instead of exiting the interrupt handler and then calling the interrupt handler
* again.
*/
do{
/* read the data into the buffer. If the buffer is full, then
* the routine doesn't accept the new byte.
*/
if(Index < BUFFER_SIZE) {
io_buffer[Index]= (u_8) inp(r_dir);
Index++;
}
assert(Index <= BUFFER_SIZE);
/* check for another incoming byte unless the end of the string
* is detected.
*/
isr0_byte = isr0_byte & ~b_bi;
if(!(isr0_byte & b_end)){
isr0_byte = isr0_byte | (u_8) inp(r_isr0);
}
}while (isr0_byte&b_bi);
/* ..if a complete message has been received, interpret before exiting
*/
if (isr0_byte & b_end) parse_input_buffer();
}

void handle_BO_int(void) {
/* This routine places the next byte from the output buffer into the NAT9914. If
* the device was reading data and received a spurious command to write, the function
* issues an error message to the GPIB controller and exits.
*/
assert( GPIB_state==idle_state ||
GPIB_state==reading_state ||
GPIB_state==writing_state);
/* ...update the GPIB state
*/
if (GPIB_state == idle_state) {
/* ...only write if data has been written to the output buffer
*/
if (Index == 0) {
isr0_byte= isr0_byte & ~b_bo;
}
else {
Index = 0;
GPIB_state = writing_state;
}
}
/* ...If the controller and the device are both trying to read data, set an error
* flag in the serial poll response byte
*/
else if (GPIB_state == reading_state){
set_status_byte_bits(error_writing);
isr0_byte = isr0_byte & ~b_bo;
}
/* ...write the data bytes to the NAT9914 until the listener stops listening or the
* device runs out of data. To improve performance loop instead of exiting the
* interrupt handler and then calling the interrupt handler again.
*/
while (isr0_byte&b_bo){
assert(Index <= BUFFER_SIZE);
/* ...output a byte from the output buffer
*/
outp(r_cdor, io_buffer[Index]);
Index++;
/* ...check if NAT9914 is ready to send another byte
*/
isr0_byte = isr0_byte & ~b_bo;
isr0_byte = isr0_byte | (u_8) inp(r_isr0);
/* ...If the device is out of data, update the serial poll response register, stop
* sending data and reset the buffer
*/
if (io_buffer[Index-1] == NEWLINE) {
clear_status_byte_bits(b_mav | b_rsv);
GPIB_state = idle_state;
Index=0;
isr0_byte = isr0_byte & ~b_bo;
}
}
assert( (Index>=0)&&(Index<=BUFFER_SIZE) );
}
/*
*
* Device Dependent Routines
*
*
*
*/
void handle_GET_trigger(void) {
/* This routine performs a device specific trigger action.
*/
/*
* insert code to implement the device specific trigger action
*/
/* release DAC holdoff to acknowledge to other routines and to the GPIB controller
* that the device specific trigger action has been completed.
*/
isr1_byte = isr1_byte & ~b_get;
outp(r_auxcr, c_nonvalid);
}
void read_voltage(void) {
/* This routine is an example of a device specific execute query.
*/
/* ...read the device specific data
*/
/* ...format the device specific data
*/
/* ...output the data to the output buffer
*/
output_data_to_io_buffer('1');
output_data_to_io_buffer('.');
output_data_to_io_buffer('2');
output_data_to_io_buffer('V');
}
void adjust_tare(void) {
/* adjust_tare is an example of a device specific execute command.
*/
/*
* insert your device specific code here
*/
}
/*
*
* GPIB Buffer Routines
*
*
*
*/
void output_data_to_io_buffer( u_8 data_out) {
/* output_data_to_io_buffer writes data to the output buffer. Because its input is
* provided by other functions, it has no error checking.
*/
/* ...check ranges on variables
*/
assert( GPIB_state==idle_state ||
GPIB_state==reading_state ||
GPIB_state==writing_state);
assert((Index>=0)&&(Index<BUFFER_SIZE));
/* ..place the data byte on the output buffer
*/
io_buffer[Index] = data_out;
Index = Index + 1;
}
void parse_input_buffer() {
/* parse the message and call the correct routine. Also, reset the buffer and set the
* device in idle state. If the command just received is invalid, send an error message
* to the GPIB controller.
*/
/* ...check ranges on variables
*/
assert( GPIB_state==idle_state ||
GPIB_state==reading_state ||
GPIB_state==writing_state);
assert((Index>=0) && (Index <= BUFFER_SIZE));
/* ...reset the state variables, since the device now has stopped reading GPIB data
*/
Index = 0;
GPIB_state = idle_state;
isr0_byte = isr0_byte & ~b_end;
/* ...parse the message in the input buffer
*/
if ( io_buffer[0]=='V' &&
io_buffer[1]=='O' &&
io_buffer[2]=='L' &&
io_buffer[3]=='T' &&
io_buffer[4]=='?' ) {
read_voltage();
/* ...terminate the data string and request service now that the data is
* in the buffer
*/
output_data_to_io_buffer(NEWLINE);
set_status_byte_bits(b_mav | b_rsv);
}
else if ( io_buffer[0]=='T' &&
io_buffer[1]=='A' &&
io_buffer[2]=='R' &&
io_buffer[3]=='E' )
adjust_tare();
else{
/* ...if the device received an unrecognized command, send an error
* message
*/
set_status_byte_bits(b_rsv | error_unknown_command);
}
}
/*
*
* Status Byte management routines
*
*
*
*/
void set_status_byte_bits(u_8 srq_byte) {
/* this routine encapsulates writes to the NAT9914's spmr register. It allows the
* calling routine to set any combination of bits without affecting the others. It
* presents a consistent interface for requesting serial polls. Its counterpart is
* clear_status_byte_bits()
*/
u_8 srq_response_byte;
srq_response_byte = (u_8) inp(r_spsr);
srq_response_byte = srq_response_byte | srq_byte;
srq_response_byte = srq_response_byte & ~b_rsv;
outp(r_spmr, srq_response_byte );
/* ...use the rsv2 command to request a serial poll instead of the rsv bit. The rsv2
* command clears itself after the serial poll and mixing rsv2 and rsv can cause
* undefined behavior.
*/
if(srq_byte & b_rsv){
outp(r_auxcr, c_rsv2);
}
}
void clear_status_byte_bits(u_8 srq_byte) {
/* this routine encapsulates writes to the NAT9914's spmr register. It allows the
* calling routine to clear any combination of bits without affecting the others by
* clearing the bits corresponding to the asserted bits of its input. It presents a
* consistent interface for ceasing to request serial polls. Its counterpart is
* set_status_byte_bits().
*/
u_8 srq_response_byte;
srq_response_byte = (u_8) inp(r_spsr);
srq_response_byte = srq_response_byte & ~srq_byte;
srq_response_byte = srq_response_byte & ~b_rsv;
outp(r_spmr, srq_response_byte );
/* ...use the rsv2 command to stop requesting a serial poll instead of the rsv bit.
* The rsv2 command clears itself after the serial poll and mixing rsv2 and rsv can
* cause undefined behavior.
*/
if(srq_byte & b_rsv){
outp(r_auxcr, c_nrsv2);
}
}

出0入0汤圆

发表于 2012-11-27 21:46:25 | 显示全部楼层
//Gpibdevc.h
/*
gpibdevc.h
*/
#define Base_Address 0x1080
#define error_reading 1<<0
#define error_writing 1<<1
#define error_unknown_command 1<<2
#define NEWLINE 0x0a /* line feed */
#define PORT_D 0x1008
#define interrupt_vector 0xFFF2
/* define i/o addresses of the registers on the nat9914 */
#define r_isr0 (Base_Address )
#define r_imr0 (Base_Address )
#define r_isr1 (Base_Address+1 )
#define r_imr1 (Base_Address+1 )
#define r_adsr (Base_Address+2 )
#define r_imr2 (Base_Address+2 )
#define r_eosr (Base_Address+2 )
#define r_bcr (Base_Address+2 )
#define r_accr (Base_Address+2 )
#define r_bsr (Base_Address+3 )
#define r_auxcr (Base_Address+3 )
#define r_isr2 (Base_Address+4 )
#define r_adr (Base_Address+4 )
#define r_spmr (Base_Address+5)
#define r_spsr (Base_Address+5)
#define r_cptr (Base_Address+6)
#define r_ppr (Base_Address+6)
#define r_dir (Base_Address+7)
#define r_cdor (Base_Address+7)
/* NAT9914 registers in 7210 mode */
#define r7210_auxmr (Base_Address+5)
/* isr0 bits*/
#define b_int0 0x80
#define b_int1 0x40
#define b_bi 0x20
#define b_bo 0x10
#define b_end 0x08
#define b_spas 0x04
#define b_rlc 0x02
#define b_mac 0x01
/* imr0 bits*/
#define b_dma0 0x80
#define b_dma1 0x40
#define b_bi_ie 0x20
#define b_bo_ie 0x10
#define b_end_ie 0x08
#define b_spas_ie 0x04
#define b_rlc_ie 0x02
#define b_mac_ie 0x01
/* isr1 bits*/
#define b_get 0x80
#define b_err 0x40
#define b_unc 0x20
#define b_apt 0x10
#define b_dcas 0x08
#define b_ma 0x04
#define b_srq 0x02
#define b_ifc 0x01
/* imr1 bits*/
#define b_get_ie 0x80
#define b_err_ie 0x40
#define b_unc_ie 0x20
#define b_apt_ie 0x10
#define b_dcas_ie 0x08
#define b_ma_ie 0x04
#define b_srq_ie 0x02
#define b_ifc_ie 0x01
/* adsr bits */
#define b_rem 0x80
#define b_llo 0x40
#define b_atn 0x20
#define b_lpas 0x10
#define b_tpas 0x08
#define b_la 0x04
#define b_ta 0x02
#define b_ulpa 0x01
/* imr2 bits */
#define b_glint 0x80
#define b_stbo_ie 0x40
#define b_nlen 0x20
#define b_lloc_ie 0x08
#define b_atni_ie 0x04
#define b_cic_ie 0x01
/* bcr bits */
#define b_bcr_atn 0x80
#define b_bcr_dav 0x40
#define b_bcr_ndac 0x20
#define b_bcr_nrfd 0x10
#define b_bcr_eoi 0x08
#define b_bcr_srq 0x04
#define b_bcr_ifc 0x02
#define b_bcr_ren 0x01
/* accr fields (shadow registers)*/
#define f_icr 0x20
#define f_accra 0x80
#define f_accrb 0xa0
#define f_accre 0xc0
#define f_accrf 0xd0
#define f_accri 0xe0
/* bsr bits are identical to bcr*/
/* isr2 bits */
#define b_nba 0x80
#define b_stbo 0x40
#define b_nl 0x20
#define b_eos 0x10
#define b_lloc 0x08
#define b_atni 0x04
#define b_cic 0x01
/* adr bits */
#define b_edpa 0x80
#define b_dal 0x40
#define b_dat 0x20
/* spmr/spsr bits */
#define b_rsv 0x40
#define b_mav 0x10
/* accra bits */
#define b_bin 0x10
#define b_xeos 0x08
#define b_reos 0x04
/* accrb bits */
#define b_iss 0x10
#define b_inv 0x08
#define b_lwc 0x04
#define b_speoi 0x02
#define b_atct 0x01
/* accre bits */
#define b_dhadt 0x08
#define b_dhadc 0x04
/* accrf bits */
#define b_dhata 0x08
#define b_dhala 0x04
#define b_dhuntl 0x02
#define b_dhall 0x01
/* accri bits */
#define b_ustd 0x08
#define b_pp1 0x04
#define b_dmae 0x01
/* accr~icr bits */
#define f_1mhz 0x01
#define f_2mhz 0x02
#define f_3mhz 0x03
#define f_4mhz 0x04
#define f_5mhz 0x05
#define f_6mhz 0x06
#define f_7mhz 0x07
#define f_8mhz 0x08
/* auxcr commands */
#define c_nswrst 0x00
#define c_swrst 0x80
#define c_nonvalid 0x01
#define c_valid 0x81
#define c_rhdf 0x02
#define c_nhdfa 0x03
#define c_hdfa 0x83
#define c_nhdfe 0x04
#define c_hdfe 0x84
#define c_nbaf 0x05
#define c_nfget 0x06
#define c_fget 0x86
#define c_nrtl 0x07
#define c_rtl 0x87
#define c_feoi 0x08
#define c_nlon 0x09
#define c_lon 0x89
#define c_nton 0x0a
#define c_ton 0x8a
#define c_gts 0x0b
#define c_tca 0x0c
#define c_tcs 0x0d
#define c_nrpp 0x0e
#define c_rpp 0x8e
#define c_nsic 0x0f
#define c_sic 0x8f
#define c_nsre 0x10
#define c_sre 0x90
#define c_rqc 0x11
#define c_rlc 0x12
#define c_ndai 0x13
#define c_dai 0x93
#define c_pts 0x14
#define c_nstdl 0x15
#define c_stdl 0x95
#define c_nshdw 0x16
#define c_shdw 0x96
#define c_nvstdl 0x17
#define c_vstdl 0x97
#define c_nrsv2 0x18
#define c_rsv2 0x98
#define c_sw7210 0x99
#define c_reqf 0x1a
#define c_reqt 0x9a
#define c_ch_rst 0x1c
#define c_nist 0x1d
#define c_ist 0x9d
#define c_piimr2 0x1e
#define c_pibcr 0x1f
#define c_clrpi 0x9c
#define c_pieosr 0x9e
#define c_piaccr 0x9f
/* NAT9914 in 7210 mode commands */
#define c7210_sw9914 0x15
typedef unsigned char u_8;
/* buffer and GPIB state declarations */
#define BUFFER_SIZE 15
#define idle_state 1
#define reading_state 2
#define writing_state 3
/* function declarations
*/
void initialize_device(void);
u_8 get_gpib_address(void);
void route_nat9914_interrupts(void);
void handle_DCAS_int(void);
void handle_BI_int(void);
void handle_BO_int(void);
void handle_GET_trigger(void);
void parse_input_buffer(void);
void read_voltage(void);
void adjust_tare(void);
void output_data_to_io_buffer(u_8);
void initialize_microcontroller(void);
void initialize_NAT9914(void);
void set_status_byte_bits(u_8);
void clear_status_byte_bits(u_8);

出0入0汤圆

发表于 2012-11-27 21:50:24 | 显示全部楼层
请教一下:
  采用查询方式后,在接收数据时,if (isr0_byte & b_bi) handle_BI_int();
   ISR0的BI位总是不能置位,真是莫名奇妙,始终不知道什么原因。
  有知道的能否给告诉一下,不胜感激!

出0入0汤圆

 楼主| 发表于 2013-4-14 13:27:14 | 显示全部楼层
好长时间没上来了,呵呵
我后面改了芯片,那个nat9914搞了好长时间没搞定,没办法,后来换芯片了。

出0入0汤圆

发表于 2013-4-22 22:28:55 | 显示全部楼层
NAT9914我在别人的帮助下,搞定了

出0入0汤圆

发表于 2013-5-14 21:04:07 | 显示全部楼层
iamlangzi 发表于 2012-11-27 21:50
请教一下:
  采用查询方式后,在接收数据时,if (isr0_byte & b_bi) handle_BI_int();
   ISR0的BI位总是 ...

请问这问题是如何解决的?

出0入0汤圆

发表于 2013-5-20 18:42:07 | 显示全部楼层
按照 前面xyz543 的程序来做,可以完成NAT9914的GPIB功能

出0入0汤圆

发表于 2013-5-24 22:13:22 | 显示全部楼层
iamlangzi 发表于 2013-5-20 18:42
按照 前面xyz543 的程序来做,可以完成NAT9914的GPIB功能

请问你发的这个程序不能用吗?gpibdevc.c 7/28/97这个//现在用stm32调试不通,PC能识别出来,但是读取寄存器错误。

出0入0汤圆

发表于 2013-5-25 13:40:59 | 显示全部楼层
目前在调试NAT9914,学习中。
iamlangzi    outp(r_auxcr, c_ch_rst);这个调用的函数能否具体说明下,我对下自己写的是否正确。

出0入0汤圆

发表于 2013-5-25 14:21:48 | 显示全部楼层
在不连设备的情况下,如何确定NAT9914初始化成功?

出0入0汤圆

发表于 2013-5-25 16:57:59 | 显示全部楼层
虽然GPIB接口还在服役,但是真心觉得太不方便了,实现和使用成本都高

出0入0汤圆

发表于 2013-5-25 18:39:05 | 显示全部楼层
outp(r_auxcr, c_ch_rst)可以根据NAT9914的写时序波形来实现

出0入0汤圆

发表于 2013-5-26 09:22:37 | 显示全部楼层
谢谢iamlangzi ,请问在不连设备的情况下,如何确定NAT9914初始化成功?

出0入0汤圆

发表于 2013-5-27 10:11:54 | 显示全部楼层
本帖最后由 Cavyndee 于 2013-5-27 10:13 编辑

使用STM32F1的FSMC模式1时序来读写NAT9914的寄存器,电脑能识别出设备,但是调试发现读取寄存器错误。使用IO口模拟时序,就识别不出设备,貌似写寄存器错误,读寄存器可以。
void outp(u8 Addr,INT8U Data)
{
    INT16U i;
    GPIO_Output_Config();
    GPIOF->ODR = Addr;     
    GPIOC->ODR = Data;
    DBIN_1;
    _WE_1;
    _CE_1;
    _CE_0;
    _WE_0;
//    for(i = 0; i < 0x1; i++);  
    _WE_1;
    _CE_1;
}
INT8U inp(INT8U Addr)
{
    INT8U Data;
    INT16U i;
    GPIO_Input_Config();
    DBIN_1;
    _CE_1;
    GPIOF->ODR = Addr;
    DBIN_0;
    _CE_0;
//    for(i = 0; i < 0x1; i++);  //delay
    Data=(u16)GPIOC->IDR;
    _CE_1;
    DBIN_1;
    return Data;
}
DBIN脚外接一反相器

出0入0汤圆

发表于 2013-6-7 22:18:38 | 显示全部楼层
Cavyndee,你的模拟读写时序要按照NAT9914的读写时序来写,看了一下,应该没问题,如果出现读取寄存器错误,应该是其他程序出现问题了。
我建议你参考xyz543 的程序来做,采用中断的方式

出0入0汤圆

发表于 2013-8-1 13:47:29 | 显示全部楼层
xyz543 发表于 2012-11-16 11:00
楼主应该是要驱动 NI 的 NAT9914 吧? 我冒着工作不保的风险传给您我们公司商业用的标准驱动代码,希望能带给 ...

看了一遍datasheet  云山雾绕 ,xyz543有时间给大家讲一讲吗?

出0入34汤圆

发表于 2013-8-1 14:25:18 | 显示全部楼层
本帖最后由 xyz543 于 2013-8-1 16:46 编辑
Icyan 发表于 2013-8-1 13:47
看了一遍datasheet  云山雾绕 ,xyz543有时间给大家讲一讲吗?


要我讲这个我也不是全然了解,只不过我们公司的一些产品一直都是用我贴于 16 楼的代码修改与移植的,跑起来也都没问题,至少客户至今都没反应问题的.

我的建议是请您去找一本书,书名是 "IEEE 488.2/SCPI 原理及介面设计" 陈正忠 编著,几乎我们使用这 GPIB 的代码都是依这本书内的解释 Codeing 而来的.

要不..... 您也可以去这里-> ZhaoIC 的 NAT9914调试记录   参考看看,或许他这篇所提到的那篇论文可以为您解惑唷!

这就是这本 "IEEE 488.2/SCPI 原理及介面设计" 的照片:



若真有兴趣的话,这本书的 ISBN : 957-21-1300-3

编辑原因: 增加照片及说明等..

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

发表于 2013-8-2 16:26:57 | 显示全部楼层
xyz543 发表于 2013-8-1 14:25
要我讲这个我也不是全然了解,只不过我们公司的一些产品一直都是用我贴于 16 楼的代码修改与移植的,跑起来 ...

谢谢   xyz543  继续读datasheet

出0入34汤圆

发表于 2013-8-2 17:02:56 | 显示全部楼层
Icyan 发表于 2013-8-2 16:26
谢谢   xyz543  继续读datasheet

不客气! 还有一点您要留意,就是那 NAT9914 的 Data Bus (总线) 的 D0 ~ D7 是与实际在使用的 MCU 单片机的 Data Bus 相反接的,如 NAT9914 的 D0 要接到 MCU 的 D7,相对的 NAT9914 的 D1 要接到 MCU 的 D6,以此类推...

出0入0汤圆

发表于 2014-5-19 20:38:21 | 显示全部楼层
了解了解

出0入0汤圆

发表于 2014-9-2 19:40:11 | 显示全部楼层
xyz543 发表于 2013-8-2 17:02
不客气! 还有一点您要留意,就是那 NAT9914 的 Data Bus (总线) 的 D0 ~ D7 是与实际在使用的 MCU 单片机 ...

你好!有个问题想请教你一下,我的NAT9914用Agient IO control可以搜索到设备,可设备不稳定,再次搜索的时候就掉了,并且收发数据也有问题,请问这是什么原理导致的?谢谢!

出0入34汤圆

发表于 2014-9-3 09:40:11 | 显示全部楼层
chenvictory 发表于 2014-9-2 19:40
你好!有个问题想请教你一下,我的NAT9914用Agient IO control可以搜索到设备,可设备不稳定,再次搜索的 ...

您这个问得太笼统了,我无法确定您是遇到了什么问题,不过应该可以藉由 GPIB Debug 给找出问题。
因为您用得是 NI 的 Controller,所以您手先要安装 NI 的程序(National Instruments),点选启动 Measurement & Automation Exploere,再点选 Devices and Interface,再点选您的 GPIB 装置如 GPIB0。
其后,在这 Measurement & Automation Exploere 上方有个 NI Spy,点选它并按下开始键开使截取,然而再回到 Measurement & Automation Exploere 选找寻仪器,找到后再与仪器通讯。
此时,您与设备端的通讯的每一项细步的动作都会被这个 NI Spy 给记录下来,您再分析这些动作与封包的状况吧!
另一点要提醒您,在 Measurement & Automation Exploere 有个属性的选项,输入/输出逾时不要设太短的时间,一般约 10sec,再选进阶的标签页,有个汇流排时间设到 500nsec 即可,祝您好运!

出0入0汤圆

发表于 2014-10-21 15:16:43 | 显示全部楼层
iamlangzi 发表于 2013-6-7 22:18
Cavyndee,你的模拟读写时序要按照NAT9914的读写时序来写,看了一下,应该没问题,如果出现读取寄存器错误 ...

大虾,发个你的原理图给我参考哈了。淘宝买了器件,正准备自己搞一个玩玩

出0入0汤圆

发表于 2014-10-21 15:23:43 | 显示全部楼层
没用过,MARK下!

出0入0汤圆

发表于 2014-10-28 11:02:36 | 显示全部楼层
最近也接触到这个,头疼,

出0入0汤圆

发表于 2015-5-5 20:20:16 | 显示全部楼层
xyz543 发表于 2012-11-23 17:15
我已将您要的东西移植到 Keil C51 的工程上了,接下来您得自己学习了.  

你好,可以外包一个GPIB的项目给你做吗?用STM32控制GPIB芯片跟上位机通信,可以报个价,IC是TNT4882芯片

出0入34汤圆

发表于 2015-5-6 00:57:26 | 显示全部楼层
HETAO123 发表于 2015-5-5 20:20
你好,可以外包一个GPIB的项目给你做吗?用STM32控制GPIB芯片跟上位机通信,可以报个价,IC是TNT4882芯片 ...

真是不好意思,我工作的性质是不能接外包工作的,且对您这 TNT4882 的芯片也不是很了解,盼您能谅解。

出0入0汤圆

发表于 2015-9-18 14:17:40 | 显示全部楼层
xyz543 发表于 2015-5-6 00:57
真是不好意思,我工作的性质是不能接外包工作的,且对您这 TNT4882 的芯片也不是很了解,盼您能谅解。 {: ...

你好,您推荐的那本书哪里买得到呢???

出0入34汤圆

发表于 2015-9-18 16:59:12 | 显示全部楼层
guolh_bj 发表于 2015-9-18 14:17
你好,您推荐的那本书哪里买得到呢???

在台湾可以买得到,我有附上这本书的 ISBN 号,您可以找找代购看看。

出0入0汤圆

发表于 2015-9-22 16:35:39 | 显示全部楼层
xyz543 发表于 2015-9-18 16:59
在台湾可以买得到,我有附上这本书的 ISBN 号,您可以找找代购看看。

谢谢,代购太麻烦了,如果有PDF就好了

出0入0汤圆

发表于 2015-10-10 22:01:56 | 显示全部楼层
xyz543 发表于 2013-8-1 14:25
要我讲这个我也不是全然了解,只不过我们公司的一些产品一直都是用我贴于 16 楼的代码修改与移植的,跑起来 ...

朋友你好,我在深圳广州各个书店书城找了个遍,还是没有找到你说的关于GPIB的那本书,网上也找不到这本书卖,是否只有你们那边才有呢,这样能否帮代购一本,我愿意出各种费用的,先谢谢了。

出0入34汤圆

发表于 2015-10-10 22:32:49 | 显示全部楼层
X594008 发表于 2015-10-10 22:01
朋友你好,我在深圳广州各个书店书城找了个遍,还是没有找到你说的关于GPIB的那本书,网上也找不到这本书 ...

刚帮您在我们这儿较大的网路书店都找了一圈,全部都显示已停止贩售了,目前是没其他的方法啦,只能等看看那全华书店是否有可能再印刷一批再版的来卖了!

出0入0汤圆

发表于 2015-10-11 10:19:28 | 显示全部楼层
xyz543 发表于 2015-10-10 22:32
刚帮您在我们这儿较大的网路书店都找了一圈,全部都显示已停止贩售了,目前是没其他的方法啦,只能等看看 ...

额,好吧!谢谢了。如果有出售记得通知一下我,万分感谢。

出0入0汤圆

发表于 2015-10-11 10:41:43 | 显示全部楼层
xyz543 发表于 2015-10-10 22:32
刚帮您在我们这儿较大的网路书店都找了一圈,全部都显示已停止贩售了,目前是没其他的方法啦,只能等看看 ...

可惜那家做仪表的铨华了,被chroma收购了。

出0入34汤圆

发表于 2015-10-11 13:01:27 | 显示全部楼层
X594008 发表于 2015-10-11 10:19
额,好吧!谢谢了。如果有出售记得通知一下我,万分感谢。

好,若我有找到书的话,我就多买一些,找一位内地的坛友先都发到他那儿,再请这位坛友帮忙发给有需求的谭友吧!~  

出0入34汤圆

发表于 2015-10-11 13:20:53 | 显示全部楼层
xtrig 发表于 2015-10-11 10:41
可惜那家做仪表的铨华了,被chroma收购了。

是啊!您说的那个应该是诠华电子股份有限公司,感觉之前应算是个小公司吧?!我说的是 全华图书股份有限公司 啊!是个出版社的书商来着的,呵呵!~

出0入0汤圆

发表于 2015-10-11 14:11:58 | 显示全部楼层
现在还做GPIB啊,我以为早淘汰了呢,我倒是以前干过很久的GPIB ,90年代的时候

出0入0汤圆

发表于 2015-10-11 17:52:02 | 显示全部楼层
xyz543 发表于 2015-10-11 13:20
是啊!您说的那个应该是诠华电子股份有限公司,感觉之前应算是个小公司吧?!我说的是 全华图书股份有限 ...

铨华也是家上市公司,被Chroma在股市上玩残了,道听途说的啊,呵呵。

出0入34汤圆

发表于 2015-10-11 18:01:15 | 显示全部楼层
xtrig 发表于 2015-10-11 17:52
铨华也是家上市公司,被Chroma在股市上玩残了,道听途说的啊,呵呵。

嗯!...在我们这儿的电子圈内真是没听过这家(指铨华)啊,哈!~

出0入0汤圆

发表于 2015-10-11 18:12:05 | 显示全部楼层
xyz543 发表于 2015-10-11 18:01
嗯!...在我们这儿的电子圈内真是没听过这家(指铨华)啊,哈!~  ...

十几年前也算一家产品种类众多的仪器公司,用它家的设备组建电源ATE,可惜现在只能在二手市场里淘到些文物了。让人唏嘘。

http://www.szmtyq.com/szmtyq_Category_305154_1.html

出0入34汤圆

发表于 2015-10-11 20:10:18 | 显示全部楼层
xtrig 发表于 2015-10-11 18:12
十几年前也算一家产品种类众多的仪器公司,用它家的设备组建电源ATE,可惜现在只能在二手市场里淘到些文 ...

好吧!算我孤陋寡闻,在台湾的电子圈内没听过更别说见过了,除非他们专给别人贴牌做 OEM,不然我真是...没听过也不知道呢!~  

出0入34汤圆

发表于 2015-10-11 20:32:31 | 显示全部楼层
ericdai 发表于 2015-10-11 14:11
现在还做GPIB啊,我以为早淘汰了呢,我倒是以前干过很久的GPIB ,90年代的时候 ...

这 GPIB 近几十年都是 NI 捞钱的项目,若 NI 不肯放手,大家只好跟着走。
而话说这 GPIB 的去留有点类似 8051 状况差不多,就因为它是可将仪器设备给连接起来,故多数的生产线在添购设备时都对 GPIB 有着需求,旧设备被保留,新设备能相容。
唯有如此,厂商们能以较低的代价,达到较多的控制设备的需求,而 SCPI 的功能也再增加程序命令就行。
若换了只有 RS-232、RS-485、USB、CAN、Internet 等设备的话,而他们于上位机端的程序与操作就头痛了,呵呵~  

出0入0汤圆

发表于 2015-10-11 22:06:15 | 显示全部楼层
GPIB目前在技术上已没有优势,速度干不过PXI和LXI,抗干扰能力如不光网络,而且笨重的cable,居高不落的价格,让人想爱也爱不起来。
而SCPI的意义就在于统一上位机端的编程接口,忽略总线类型,以达到设备及总线类型可以更换而上位机软件不用修改或大改的目的。

出0入0汤圆

发表于 2015-10-11 22:58:02 | 显示全部楼层
xyz543 发表于 2015-10-11 20:32
这 GPIB 近几十年都是 NI 捞钱的项目,若 NI 不肯放手,大家只好跟着走。
而话说这 GPIB 的去留有点类似  ...

迟早会被以太网淘汰,粗笨的电缆,很难接线,坏了一时半会找不到替代品

出0入34汤圆

发表于 2015-10-11 23:57:17 | 显示全部楼层
ericdai 发表于 2015-10-11 22:58
迟早会被以太网淘汰,粗笨的电缆,很难接线,坏了一时半会找不到替代品 ...

去年我已拿到了 Mini 版的线头与线材了,NI 也是会符合目前市场的需求有在改进的喔!

出0入0汤圆

发表于 2015-10-12 00:21:52 | 显示全部楼层
xyz543 发表于 2015-10-11 23:57
去年我已拿到了 Mini 版的线头与线材了,NI 也是会符合目前市场的需求有在改进的喔!  ...

你是做工厂自动化的吗,看起来是NI大客户啊

出0入34汤圆

发表于 2015-10-12 10:53:15 | 显示全部楼层
ericdai 发表于 2015-10-12 00:21
你是做工厂自动化的吗,看起来是NI大客户啊

我们不是 NI 个客户啦!但我们与 NI 有互惠的关系,我们造的一些商品有给 NI 贴牌,NI 他们的 R&D 与 FAE 经常的在我们公司的 R&D 区走动,而在公司内也常跟 TI 与 ADI 的 FAE 有时都搞不清楚谁是谁了,呵呵!~
至于我的工作就是一个码农而已,但产品当然至少是有包含工厂自动化与工业应用等这方面的这区块了。

出0入0汤圆

发表于 2016-4-22 09:18:01 | 显示全部楼层
刚接触GPIB,看了这个贴很受感悟!

出0入0汤圆

发表于 2017-9-2 15:02:46 | 显示全部楼层
397379140 发表于 2013-4-14 13:27
好长时间没上来了,呵呵
我后面改了芯片,那个nat9914搞了好长时间没搞定,没办法,后来换芯片了。
...

楼主您好,我现在也在用NAT9914做GPIB,您后来换了什么芯片,做成功了吗?

出0入0汤圆

发表于 2017-9-2 23:44:10 来自手机 | 显示全部楼层
为啥还有GPIB啊,以太网现在这么好用

出0入0汤圆

发表于 2017-9-3 18:04:53 | 显示全部楼层
ericdai 发表于 2017-9-2 23:44
为啥还有GPIB啊,以太网现在这么好用

vxi有延迟

出0入4汤圆

发表于 2017-9-4 09:55:38 | 显示全部楼层
NI什么时候卖芯片了

出0入0汤圆

发表于 2017-9-9 14:30:39 | 显示全部楼层
iamlangzi 发表于 2012-11-27 21:45
//Gpibdev5.c
/*
gpibdevc.c 7/28/97

非常感谢,我把这份代码移植到了STM32上,成功驱动了9914

出0入0汤圆

发表于 2017-9-9 23:28:08 | 显示全部楼层
谢谢大家的分享,学习了!!!

出0入0汤圆

发表于 2017-9-22 15:34:54 | 显示全部楼层
Cavyndee 发表于 2013-5-27 10:11
使用STM32F1的FSMC模式1时序来读写NAT9914的寄存器,电脑能识别出设备,但是调试发现读取寄存器错误。使用I ...

9914的读时序和一般的时序不同,用STM32的FSMC可以写数据到9914但不能读,除非加逻辑转换芯片

出0入0汤圆

发表于 2017-11-28 16:35:14 | 显示全部楼层
xyz543 发表于 2015-10-12 10:53
我们不是 NI 个客户啦!但我们与 NI 有互惠的关系,我们造的一些商品有给 NI 贴牌,NI 他们的 R&D 与 FAE ...

xyz543你好,看了你发的有关GPIB的贴子受益匪浅,按照你的程序我已经用STM32 IO模拟时序的方法成功驱动NAT9914了,但我们的项目现在要用FSMC接口驱动,NAT9914的读时序不是标准时序,所以芯片更换成了tnt5002,这个芯片在网上找不到示例,请问您有tnt5002的资料吗?谢谢!

出0入34汤圆

发表于 2017-11-28 17:26:06 | 显示全部楼层
玉石俱焚 发表于 2017-11-28 16:35
xyz543你好,看了你发的有关GPIB的贴子受益匪浅,按照你的程序我已经用STM32 IO模拟时序的方法成功驱动NA ...

很抱歉,这还真是没有,因为我们的客户非得要用标准 NI 的芯片,用其他的就是不买单,所以我就只有这 NAT9914 的芯片资料而已,请见谅。
另外,若有可能的话...能给我您说的这 STM32 的 I/O 模拟程序工程文件吗?我对您说的这模拟倒是蛮有兴趣的,谢谢。

出0入0汤圆

发表于 2017-11-28 18:10:28 | 显示全部楼层
xyz543 发表于 2017-11-28 17:26
很抱歉,这还真是没有,因为我们的客户非得要用标准 NI 的芯片,用其他的就是不买单,所以我就只有这 NAT ...

谢谢了!tnt5002也是NI出的GPIB控制芯片,是比较新的一款,支持PCI接口和通用接口,支持3.3V电压,芯片集成了GPIB接口收发器(省了75160和75161),只要一片MCU加上tnt5002就可以完成GPIB通信,不用外接其他芯片,附件中的例子是我用STM32的IO口模拟时序驱动了NAT9914

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入34汤圆

发表于 2017-11-28 20:34:01 | 显示全部楼层
玉石俱焚 发表于 2017-11-28 18:10
谢谢了!tnt5002也是NI出的GPIB控制芯片,是比较新的一款,支持PCI接口和通用接口,支持3.3V电压,芯片集 ...

好的,收到,我得有空再研究。
最近在捣鼓一个 GPIB 转 Internet 的东西,被上面逼得很紧,公司电脑硬碟与内部 DDR 全毁,很惨,希望今年底得搞出来,不然...会更惨!呵呵~
无论如何还是谢谢您了!~

出0入4汤圆

发表于 2017-11-28 22:04:44 | 显示全部楼层
玉石俱焚 发表于 2017-11-28 18:10
谢谢了!tnt5002也是NI出的GPIB控制芯片,是比较新的一款,支持PCI接口和通用接口,支持3.3V电压,芯片集 ...

TNT5002能拿到货么?大概什么价格?

出0入0汤圆

发表于 2017-12-21 19:10:07 | 显示全部楼层
wajlh 发表于 2017-11-28 22:04
TNT5002能拿到货么?大概什么价格?

我们好像是直接找NI销售拿的货,我有他的微信,价格不知道

出0入4汤圆

发表于 2017-12-21 19:14:19 | 显示全部楼层
玉石俱焚 发表于 2017-12-21 19:10
我们好像是直接找NI销售拿的货,我有他的微信,价格不知道

n能帮忙问下大致的价格么?不用很精确的,NI官网的报价很高,想看看他们线下是不是也这么高

出0入0汤圆

发表于 2017-12-22 09:39:03 | 显示全部楼层
wajlh 发表于 2017-12-21 19:14
n能帮忙问下大致的价格么?不用很精确的,NI官网的报价很高,想看看他们线下是不是也这么高 ...

大概是300块一片,24片起售

出0入0汤圆

发表于 2017-12-22 09:48:16 | 显示全部楼层
xyz543 发表于 2012-11-23 17:15
我已将您要的东西移植到 Keil C51 的工程上了,接下来您得自己学习了.  

make GPIB                           

出0入4汤圆

发表于 2017-12-22 10:28:32 | 显示全部楼层
玉石俱焚 发表于 2017-12-22 09:39
大概是300块一片,24片起售

300是美金还是人民币啊,官网报价是6000多人民币。

出0入0汤圆

发表于 2017-12-22 11:30:06 | 显示全部楼层
wajlh 发表于 2017-12-22 10:28
300是美金还是人民币啊,官网报价是6000多人民币。

300人民币,24片起售,官网应该是24片的价格,正好7000块

出0入4汤圆

发表于 2017-12-22 11:45:47 | 显示全部楼层
玉石俱焚 发表于 2017-12-22 11:30
300人民币,24片起售,官网应该是24片的价格,正好7000块

OK明白了,谢谢。

出0入0汤圆

发表于 2017-12-22 12:02:22 | 显示全部楼层
xyz543 发表于 2015-10-11 20:32
这 GPIB 近几十年都是 NI 捞钱的项目,若 NI 不肯放手,大家只好跟着走。
而话说这 GPIB 的去留有点类似  ...

换以太网吧

出0入34汤圆

发表于 2017-12-23 13:09:49 | 显示全部楼层
本帖最后由 xyz543 于 2017-12-23 13:12 编辑

是啊!这在搞啊!搞到目前仅剩下半口气儿了的!...

※ 编辑原因:不好意思,未点选回复就先发帖,多发的了!~

出0入34汤圆

发表于 2017-12-23 13:10:16 | 显示全部楼层

是啊!这在搞啊!搞到目前仅剩下半口气儿了的!...

出0入0汤圆

发表于 2019-8-26 17:56:39 | 显示全部楼层
你好,我现在要用FPGA来做GPIB,NAT9914的驱动,但是目前就卡在了读写芯片里寄存器的地方,请教一下,NAT9914寄存器的初始情况下各寄存器的初始值应该是多少

出0入0汤圆

发表于 2019-8-26 18:45:13 | 显示全部楼层
标记GPIB

出0入0汤圆

发表于 2019-8-26 23:00:44 | 显示全部楼层
数年前电子科大有颗自研的GPIB芯片,当时宣传的还挺多,现在没消息了。

出0入8汤圆

发表于 2021-3-10 14:47:40 | 显示全部楼层
xyz543 发表于 2012-11-23 09:52
空的括号内的程序仅是设置些错误讯息的回应而已,如 i = 1; j = 2 的类似程序,所以我没有必要都给列出来!
...

hi,你好,请教一个问题,GPIB时序图中关于,RS0-RS2这里有点疑问:
看图中的意思是需要翻转一下,是三个引脚都同步从低电平到高电平或者从高电平到低电平么?
我看9914 Register Set里面描述Data IN  两个不同的状态?
Register RS(2-0) WE* DBIN CE* ACCGR*
Data-In  1 1 1 1 1 0 1
Data-In  X X X X 0 X 0
我看了一下楼上的代码,对于RS这三个引脚并没有处理。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

发表于 2021-3-10 15:18:26 | 显示全部楼层
没用过,过来学习的

出0入34汤圆

发表于 2021-3-11 10:46:35 | 显示全部楼层
opiviqo 发表于 2021-3-10 14:47
hi,你好,请教一个问题,GPIB时序图中关于,RS0-RS2这里有点疑问:
看图中的意思是需要翻转一下,是三个 ...

那个得要去定义的啊!请见我于 11 楼贴的第 144 到 162 行,及 19 楼内的 Base_Address 即是。

出0入8汤圆

发表于 2021-3-20 15:51:21 | 显示全部楼层
xyz543 发表于 2021-3-11 10:46
那个得要去定义的啊!请见我于 11 楼贴的第 144 到 162 行,及 19 楼内的 Base_Address 即是。
...

嗯,那里看懂了,现在抓了一下Write和Read的时序,和官方AN110那个pdf的时序一致,但是感觉读写寄存器都不起作用,请教一下芯片的时钟以及时钟配置那一块有啥要求呢?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入34汤圆

发表于 2021-3-21 12:26:11 | 显示全部楼层
opiviqo 发表于 2021-3-20 15:51
嗯,那里看懂了,现在抓了一下Write和Read的时序,和官方AN110那个pdf的时序一致,但是感觉读写寄存器都 ...

先见 36 楼,看看有无踩到坑?!

出0入8汤圆

发表于 2021-3-22 09:33:39 | 显示全部楼层
xyz543 发表于 2021-3-21 12:26
先见 36 楼,看看有无踩到坑?!

感谢您的回复,看了一下36楼,这一点有注意到,MCU和NAT9914的引脚位是反的,MCU的D0对应的是9914的D7,D1对应D6等等等......

出0入34汤圆

发表于 2021-3-23 09:10:02 | 显示全部楼层
opiviqo 发表于 2021-3-22 09:33
感谢您的回复,看了一下36楼,这一点有注意到,MCU和NAT9914的引脚位是反的,MCU的D0对应的是9914的D7,D ...

那您的提问我就不清楚了,我们一般都是给 12MHz 的外部时钟,没出现过啥问题。
那时钟配置只要在规格内都可以正常工作,只是 GPIB 总线上回应的快慢差别而已。

出0入8汤圆

发表于 2021-3-23 22:08:20 | 显示全部楼层
xyz543 发表于 2021-3-23 09:10
那您的提问我就不清楚了,我们一般都是给 12MHz 的外部时钟,没出现过啥问题。
那时钟配置只要在规格内都 ...

另外请问一下,我在您另外一个帖子里面提到了GPIB Master或者说Slave模式,但是我整体看了一下,他只有听,讲,控三者。

出0入34汤圆

发表于 2021-3-24 09:33:37 | 显示全部楼层
opiviqo 发表于 2021-3-23 22:08
另外请问一下,我在您另外一个帖子里面提到了GPIB Master或者说Slave模式,但是我整体看了一下,他只有听 ...

通常 Masert 是指 PC 电脑端, Slave 是指设备端,而设备端较不会去下令给电脑端,而一般多是电脑端下令给设备端。
而那听,讲,控是指实体最底物理层的控制讯号状态,比 Master 或 Slave 模式更为底层一种资料交换的状态。

出0入8汤圆

发表于 2021-3-24 15:06:10 | 显示全部楼层
xyz543 发表于 2021-3-24 09:33
通常 Masert 是指 PC 电脑端, Slave 是指设备端,而设备端较不会去下令给电脑端,而一般多是电脑端下令 ...

谢谢,另外我想问一下能否用两张NI的GPIB-USB-HS,互相之间通信呢?
一个当做PC端的Master,一个当设备端的Slave?
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-4-20 13:47

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表