« KORG DS-10 PLUS | Main | 青い芝生 »

June 28, 2009

EZ-USB はじめの一歩

基本中の基本でしょうけど、LEDピコピコ。とりあえず動いたー!

MacOS XでCypress EZ-USB」さんの記事、オプティマイズさんのソース、書籍などを参考に タイマーを動かし、割り込みで PB0 に繋いだLEDを点滅させたものです。

今のところたったこれだけだけど、プログラムを作るにはいったいどこをどう調べたら良いのか見当がつかなくて疲れました。

ソース ledtest.c

#include "fx2.h"
#include "fx2regs.h"

// globals
data unsigned char gTickCount;

#define kLEDOnInt	10
#define kLEDOffInt	90

#define LED_DATA_PIN (1 << 0)

void timer0_init(){
	TR0 = 0;		//Stop Timer
	TMOD = 0x01;	// timer0 16bit
	CKCON = (CKCON&(~0x08)) | 0x08;	// clock devidor T0M:1(48MHz/4 = 12MHz)
	TR0 = 1;	// Enable Timer 0
	ET0 = 1;	//Enable Timer0 interrupt

}

void timer0(void) interrupt 1
{
	TL0 = LSB(0x10000-12000000/1000);
	TH0 = MSB(0x10000-12000000/1000);
		
	gTickCount++;
	if(IOB & LED_DATA_PIN) {			// LEDが点灯していれば
		if(gTickCount >= kLEDOnInt) {
			IOB &= ~LED_DATA_PIN;	// LED OFF
			gTickCount = 0;
		}
	}
	else{
		if(gTickCount >= kLEDOffInt){
			IOB |= LED_DATA_PIN;	//LED ON
			gTickCount = 0;
		}
	}	
}

void main(void)
{
	EA = 0;		// interrupt disable
	gTickCount = 0;
	timer0_init();	//タイマー初期化、起動
	
	OEB |= LED_DATA_PIN;		// PB.0を出力に設定
	IOB &= ~LED_DATA_PIN;		// PB.0 消灯
	
	EA = 1;		//Interrupt Enable
	
}

※無駄やら間違いやらあったらすみません・・・


ターミナル.appを起動し、ソースの場所に移動し、ビルド。
sdcc -L ../Target/Lib/LP -I ../Target/Inc ledtest.c (ライブラリ、ヘッダファイルの位置は自分の物に合わせる)
できた「ledtest.ihx」を「04B48613.hex」にリネーム
mv ledtext.ihx 04B48613.hex
EZ-USBをUSBケーブルで繋ぎ、
Ezload 0x04B4 0x8613
で、ファームウェアをロード。点滅が始まります。

|

« KORG DS-10 PLUS | Main | 青い芝生 »

電子工作」カテゴリの記事

Comments

Does your blog have a contact page? I'm having problems locating it but, I'd like to send you an email. I've got some ideas for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it improve over time.

Posted by: dentist filling Dallas | February 22, 2015 08:00 AM

I'm not sure why but this website is loading very slow for me. Is anyone else having this issue or is it a problem on my end? I'll check back later on and see if the problem still exists.

Posted by: residential roofing materials Smyrna | February 22, 2015 08:16 AM

Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why waste your intelligence on just posting videos to your site when you could be giving us something informative to read?

Posted by: cleaning terracotta tiles Plano TX | February 22, 2015 09:41 AM

Hola! I've been following your blog for a while now and finally got the bravery to go ahead and give you a shout out from Huffman Tx! Just wanted to tell you keep up the excellent work!

Posted by: Atlas Chalet Shingles blistering | February 24, 2015 02:11 AM

Quality posts is the important to invite the visitors to go to see the site, that's what this web page is providing.

Posted by: Home Rodent Control Winnipeg | February 24, 2015 02:18 AM

Hi there! I realize this is somewhat off-topic but I needed to ask. Does building a well-established blog like yours take a lot of work? I'm brand new to running a blog but I do write in my journal every day. I'd like to start a blog so I can easily share my personal experience and thoughts online. Please let me know if you have any suggestions or tips for new aspiring blog owners. Appreciate it!

Posted by: Exterminator Company Scarborough | February 24, 2015 02:59 AM

I am extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you modify it yourself? Either way keep up the excellent quality writing, it's rare to see a great blog like this one today.

Posted by: arrested for dui fort worth tx | February 24, 2015 08:25 AM

Excellent pieces. Keep writing such kind of info on your page. Im really impressed by your site. Hello there, You've done a fantastic job. I'll definitely digg it and for my part recommend to my friends. I am confident they will be benefited from this site.

Posted by: webpage | February 24, 2015 09:40 AM

Hi there, just became alert to your blog through Google, and found that it's truly informative. I'm gonna watch out for brussels. I will be grateful if you continue this in future. Lots of people will be benefited from your writing. Cheers!

Posted by: search engine optimization ranking Dallas | February 25, 2015 08:53 PM

It's actually a cool and helpful piece of information. I am happy that you just shared this helpful info with us. Please stay us informed like this. Thank you for sharing.

Posted by: try online dating sites | February 25, 2015 09:03 PM

It's truly very complicated in this full of activity life to listen news on Television, thus I simply use world wide web for that reason, and take the neewest information.

Posted by: get paid to take online surveys | February 25, 2015 11:18 PM

I was able to find good advice from your blog articles.

Posted by: get paid to do surveys | February 26, 2015 05:24 PM

Hi, all the time i used to check blog posts here early in the dawn, since i like to gain knowledge of more and more.

Posted by: view it | February 27, 2015 12:41 PM

This requires all the registrars to independently review the same clinical record and then jointly assess the information points.

Posted by: trauma registry course | February 28, 2015 12:33 PM

Great article.

Posted by: Josef | March 01, 2015 10:17 AM

Inspiring quest there. What occurred after? Take care!

Posted by: Crystle | March 01, 2015 03:00 PM

Quality posts is the secret to be a focus for the visitors to visit the web page, that's what this site is providing.

Posted by: Tarah | March 02, 2015 05:37 AM

It is only a fantastic item partticularly for males, who want to find out to flirt or enhance it. Magnetic Messaging, it must be stated, does not have only one miracle text that will convince the lady presently; having said that the approaches within the guide happen to be proven tto get the job done and in addition have achieved constructive results a lot of males throughout the globe.

Posted by: texting women | March 09, 2015 12:32 PM

I'm now not sure where you're getting your information, but good topic. I must spend a while learning more or figuring out more. Thanks for great info I used to be looking for this information for my mission.

Posted by: webpage | March 13, 2015 11:40 PM

Wоnderful work! That is the kind of information that sҺoսld be shared across the net. Shame on Google for no longer positioning thіs submit higher! Comme on over and discuss with myy աeb site . TҺank you =)

Posted by: free download sharecash Downloader v1.2013 | March 14, 2015 01:05 AM

This is an obvious and immediate failing of both credit card and bank account numbers. To receive the money, you must have an account with one of these banks. I've always found Symantec to be one of the industry leaders in virus and spyware removal technologies, and Norton 360 continues in this tradition, offering the same quality of protection that you'll find in Norton Anti - Virus or Norton Internet Security.

Posted by: buy bitcoins how | March 15, 2015 01:24 AM

Hello there! I just wish to offer you a big thumbs up for the great info you've got right here on this post. I will be coming back to your website for more soon.

Posted by: diet tablets | March 16, 2015 07:46 AM

I am actually pleased to read this blog posts which consists of plenty of valuable information, thanks for providing these kinds of statistics.

Posted by: Hostgator coupon code | March 17, 2015 04:21 PM

Hello! Someone in my Myspace group shared this site with us so I came to give it a look. I'm definitely enjoying the information. I'm book-marking and will be tweeting this to my followers! Terrific blog and brilliant design.

Posted by: wedding planners in san francisco | March 18, 2015 12:14 PM

I know this site presents quality dependent posts and extra data, is there any other web site which gives these data in quality?

Posted by: glock magazine base plate | March 18, 2015 11:13 PM

I have been browsing online more than 4 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all web owners and bloggers made good content as you did, the web will be much more useful than ever before.

Posted by: Minneapolis Condos For Sale | March 19, 2015 12:06 AM

Hey would you mind letting me know which web host you're working with? I've loaded your blog in 3 different browsers and I must say this blog loads a lot quicker then most. Can you suggest a good hosting provider at a reasonable price? Kudos, I appreciate it!

Posted by: magazine base plate | March 19, 2015 10:52 AM

For cleansing out a small basement or for a landscaping challenge, renting a 10-yard dumpster is a superb guideline.

Posted by: Construction Dumpster Rental 74729 | March 19, 2015 12:37 PM

What's up, its fastidious article on the topic of media print, we all be familiar with media is a enormous source of information.

Posted by: click here | March 20, 2015 04:03 AM

It's only a excellentt item specifically for men, who wish to dijscover to flirt or increase it. Magnetic Messaging, it must be stated, doesn't have only one miracle text which will convince thee lady currently; having said that the solutions inside the guide arre shown to do the job and also have attained beneficial final results many males throughoyt the globe.

Posted by: date a muslim girl | March 20, 2015 11:55 PM

Good write-up. I certainly appreciate this website. Continue the good work!

Posted by: www porn co za | March 22, 2015 03:29 AM

Wow, this post is good, my sister is analyzing these kinds of things, thus I am going to tell her.

Posted by: glock magazine base plate | March 24, 2015 04:51 AM

Thanks for sharing such a fastidious thinking, paragraph is nice, thats why i have read it fully

Posted by: find auto transportation | March 26, 2015 03:20 AM

Only when developer leave some loop holes inside games.

Posted by: clash of clans hack online tool | April 01, 2015 01:21 AM

Players who've raced by way of the assorted ranges of challenges want to take on extra and that's why there is such an enormous demand for Boom Beach hack Cydia.

Posted by: Boom Beach Hack | April 06, 2015 05:15 AM

Thanks a bunch for sharing this with all folks you really recognise what you're talking about! Bookmarked. Please also talk over with my site =). We may have a link exchange contract among us

Posted by: how to break bad habits | April 07, 2015 03:28 PM

Hello to every , for the reason thaat I am acyually keen of reading thi website's post to be updted regularly. It carries good stuff.

Posted by: warez torrents | April 13, 2015 05:53 AM

Familiarize yourself with monthly premium and private medical insurance to make sure that the pills you take on a regular basis are still covered in your insurance. Moreover, it can help you avoid that tragic circumstance. The MRMIP program California Major Risk Medical Insurance Program MRMIP is available to you as a liability. If you read further you will understand why it s worth while making a choice in favor of those unable to afford it.

Posted by: health care and you | April 13, 2015 02:04 PM

Undeniably believe that that you stated. Your favorite reason appeared to be on the web the simplest factor to take note of. I say to you, I certainly get annoyed even as other folks consider worries that they just do not recognize about. You controlled to hit the nail upon the top and outlined out the entire thing with no need side effect , other folks could take a signal. Will likely be back to get more. Thank you

Posted by: www.atmo-qualitair.net | April 21, 2015 04:22 PM

Thanks in favor of sharing such a fastidious thinking, post is good, thats why i have read it entirely

Posted by: leadimpact media buying strategies | April 27, 2015 06:05 AM

hello!,I like your writing very so much! proportion we keep in touch extra approximately your post on AOL? I need an expert on this space to unravel my problem. May be that's you! Taking a look ahead to look you.

Posted by: Luxury car rental miami | May 18, 2015 02:35 AM

Bay location of impacts art deco palace service provider singapore play blackjack no dealership from neo-roman quirk.

Posted by: Cabling contractor leads | May 19, 2015 02:53 AM

Heya fantastic blog! Does running a blog similar to this require a lot of work? I've virtually no understanding of computer programming but I was hoping to start my own blog soon. Anyhow, if you have any ideas or tips for new blog owners please share. I understand this is off topic nevertheless I just had to ask. Appreciate it!

Posted by: Nouveaux Films Gratuits Les Jardins du Roi | May 26, 2015 09:48 AM

Yesterday, while I was at work, my cousin stole my apple ipad and tested to see if it can survive a 40 foot drop, just so she can be a youtube sensation. My iPad is now broken and she has 83 views. I know this is completely off topic but I had to share it with someone!

Posted by: Washington halosim | May 27, 2015 08:04 PM

Saved as a favorite, I like your site!

Posted by: Best Anti Virus Program | May 30, 2015 03:21 PM

Wow, this post is nice, my sister is analyzing such things, so I am going to let know her.

Posted by: Beststeroids | June 01, 2015 05:41 PM

If steroid hormone doses are utilized in moderations of around 200 mg every week, might found to be responsible for these complications will be ordinary and additionally two-sided. The steroid was going to be initially programmed as an approach to treat medical conditions which make the individuals' system to blow aside, most notably HIV.

Posted by: Illinois anapolon | June 07, 2015 07:03 AM

Have you ever considered about adding a little bit more than just your articles? I mean, what you say is fundamental and everything. However imagine if you added some great pictures or video clips to give your posts more, "pop"! Your content is excellent but with images and video clips, this blog could definitely be one of the very best in its field. Great blog!

Posted by: slide plates for glock | June 24, 2015 12:33 PM

Thanks for one's marvelous posting! I really enjoyed reading it, you will be a great author.I will be sure to bookmark your blog and definitely will come back someday. I want to encourage you continue your great job, have a nice holiday weekend!

Posted by: swing set installation ny | July 07, 2015 05:57 PM

Your style is unique in comparison to other people I've read stuff from. Many thanks for posting when you've got the opportunity, Guess I'll just book mark this web site.

Posted by: glock magazine plate | July 11, 2015 07:25 AM

WOW just what I was looking for. Came here by searching for wall mount gun racks

Posted by: slide plates for glock | July 15, 2015 02:50 PM

Thank you for another great post. Where else may anyone get that kind of information in such an ideal manner of writing? I've a presentation subsequent week, and I am at the look for such information.

Posted by: birthday party events | July 28, 2015 02:51 AM

Great beat ! I wish to apprentice while you amend your website, how could i subscribe for a blog web site? The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear concept

Posted by: Augustine | August 03, 2015 02:19 PM

Pretty nice post. I simply stumbled upon your blog and wanted to mention that I've really loved browsing your blog posts. In any case I will be subscribing to your rss feed and I'm hoping you write once more soon!

Posted by: magazine base plates | August 05, 2015 04:22 AM

This week our shoe queen is Sandra Bullock. So be informed What's going on in this patient all the time it's prognosis for stage 4 breast cancer with bone and liver mets repaired quite efficiently. Treatments include radiation, chemotherapy and hormone therapy for a long time, there is no choice but to remove them. Lumps that do not show effects, and no longer capable of breeding cancer.

Posted by: http://breastcancer2015.com/ | August 05, 2015 08:16 AM

m9 kılıf

Posted by: htc one m9+ kılıfları | August 17, 2015 07:42 AM

sony m5 kılıf

Posted by: m5 kılıf | September 15, 2015 09:32 PM

I'm not sure exactly why but this weblog is loading very slow for me. Is anyone else having this issue or is it a problem on my end? I'll check back later and see if the problem still exists.

Posted by: Nolan | September 28, 2015 11:31 AM

If some one needs expert view on the topic of blogging and site-building then i advise him/her to pay a visit this web site, Keep up the fastidious work.

Posted by: best vpn service 2014 | October 09, 2015 11:35 PM

Post a comment



(Not displayed with comment.)




« KORG DS-10 PLUS | Main | 青い芝生 »