搜索
bottom↓
回复: 6

求助:关于用BASCOM-AVR编写程序控制BH1415发射

[复制链接]

出0入0汤圆

发表于 2009-3-4 21:16:00 | 显示全部楼层 |阅读模式
用BASCOM-AVR编写程序控制BH1415发射,本人看了很多资料都没有作成功,主要是程序的编写,本人乐意使用BASCOM-AVR。有那位大侠帮帮忙!

出0入0汤圆

发表于 2009-3-4 23:53:02 | 显示全部楼层
请说的具体些  也好帮你

出0入0汤圆

 楼主| 发表于 2009-3-8 21:30:37 | 显示全部楼层
谢谢上面的朋友,主要是发送数据的编写,帮帮忙写一下吧!

出0入0汤圆

发表于 2009-3-11 16:30:48 | 显示全部楼层
简单看了一下BH1415的手册 感觉不难

你使用shiftout 语句应该能完成你的需要,具体使用你可以看一下bascom自带的帮助

这个是帮助中的例子

'-----------------------------------------------------------------------------------------

'name                     : shift.bas

'copyright                : (c) 1995-2005, MCS Electronics

'purpose                  : example for SHIFTIN and SHIFTOUT statement

'micro                    : Mega48

'suited for demo          : yes

'commercial addon needed  : no

'-----------------------------------------------------------------------------------------




$regfile = "m48def.dat"                                     ' specify the used micro

$crystal = 4000000                                          ' used crystal frequency

$baud = 19200                                               ' use baud rate

$hwstack = 32                                               ' default use 32 for the hardware stack

$swstack = 10                                               ' default use 10 for the SW stack

$framesize = 40                                             ' default use 40 for the frame space




Dim L As Long




clock Alias Portb.0

Output Alias Portb.1

sinp Alias Pinb.2                                            'watch the PIN instead of PORT




'shiftout pinout,pinclock, var,parameter [,bits , delay]

' value for parameter :

'  0 - MSB first ,clock low

'  1 - MSB first,clock high

'  2 - LSB first,clock low

'  3 - LSB first,clock high

'The bits is a new option to indicate the number of bits to shift out

'For a byte you should specify 1-8 , for an integer 1-16 and for a long 1-32

'The delay is an optional delay is uS and when used, the bits parameter must

'be specified too!




'Now shift out 9 most significant bits of the LONG variable L

Shiftout Output , Clock , L , 0 , 9










'shiftin pinin,pinclock,var,parameter [,bits ,delay]

'  0 - MSB first ,clock low  (4)

'  1 - MSB first,clock high  (5)

'  2 - LSB first,clock low   (6)

'  3 - LSB first,clock high  (7)




'To use an external clock, add 4 to the parameter

'The shiftin also has a new optional parameter to specify the number of bits




'The bits is a new option to indicate the number of bits to shift out

'For a byte you should specify 1-8 , for an integer 1-16 and for a long 1-32

'The delay is an optional delay is uS and when used, the bits parameter must

'be specified too!







'Shift in 9 bits into a long

Shiftin Sinp , Clock , L , 0 , 9

'use shift to shift the bits to the right place in the long

Shift L , Right , 23




End

出0入0汤圆

 楼主| 发表于 2009-3-11 19:50:59 | 显示全部楼层
谢谢!请问楼上的兄台,你编写过吗?可以帮帮忙吗?我写过但不成功。

出0入0汤圆

发表于 2009-3-12 10:30:46 | 显示全部楼层
没编过
这个芯片都没见过

呵呵 嘻嘻试一下 应该不难的

出0入0汤圆

 楼主| 发表于 2009-3-12 21:46:51 | 显示全部楼层
等楼上的好消息!
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-8 10:29

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

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