Ham is the son who sinned against his father Noah (Genesis 9:20-24). However, Noah did not curse Ham, but his son Canaan (Genesis 9:25). He did this because Ham had been previously blessed. Genesis 9:1 states, "And God blessed Noah and his sons, and said unto them, Be fruitful, and multiply, and replenish the earth." Noah and his sons (including Ham) had been blessed by the Lord. He could not be cursed by Noah.
When Balaam was asked to curse the Israelites, the Lord told him, "thou shalt not curse the people: for they are blessed" (Numbers 22:12). That is, God has already blessed them; therefore, they cannot now be cursed. That was evidently the reason Ham was not cursed. Instead, his son Canaan bore the curse.
Some Bible students interpret Ham's looking on the nakedness of his father as an act of sodomy. This remains a possibility. But the bare text seems straight forward enough. Ham studiously gazed on the nakedness of his father and then came and bragged to his brothers about this extreme breach of decency.
Habakkuk 2:15 states, "Woe unto him that giveth his neighbour drink, that puttest thy bottle to him, and makest him drunken also, that thou mayest look on their nakedness!"
That is, those who plot to look on the nakedness of others by getting them drunk are cursed--"Woe to him." A study of nakedness in the Bible shows the seriousness with which God views this kind of sin. Also in our story, Shem and Japheth are blessed because they "covered the nakedness of their father...and they saw not their father's nakedness" (Genesis 9:23) The contrast points to a more basic interpretation of the text.
You asked if the curse was generational. I understand you to ask if the curse affected the descendants of the man cursed. I think the curse of Canaan has to be placed alongside the blessings given at the same time to Shem and Japheth. Either they all referred only to the immediate recipients or they all followed the family lines of the ones blessed and cursed. Here is the passage in question:
Genesis 9:24-27 And Noah awoke from his wine, and knew what his younger son had done unto him. And he said, Cursed be Canaan; a servant of servants shall he be unto his brethren. And he said, Blessed be the LORD God of Shem; and Canaan shall be his servant. God shall enlarge Japheth, and he shall dwell in the tents of Shem; and Canaan shall be his servant.
It seems that the blessings and curses were generational. God did bless the LORD God of Shem. Abraham and the children of Israel were descendants of Shem. And the Canaanites were Shem's servants, especially after Israel conquered the land of Canaan under Joshua. Also, God did bless Japheth. The early world empires (with the exception of Egypt) were of the people of Shem. Babylon, Assyria, and Persia were all empires of Shem. However, that changed when first the Greeks and then the Romans conquered the known world. These kingdoms were of the people of Japheth. Japheth conquered the lands ruled by Shem and Japheth thereby dwelled in the tents of Shem. As to Canaan, his people also became servants to Japheth at this time. As I said, it seems definite that these blessings and this curse have a prophetic nature.
Now, what about the other sons of Ham--Cush, Mizraim, and Phut? Are they included? Many people assume they are. Otherwise, they would be left out. But why is this a problem? If Noah left God's original blessing on Ham, then why not on His other three sons? It is only by assuming something that is not said that we can claim the curse affected the other sons of Ham. Ham's judgment was that one of his sons would receive a curse because of his perverted act. The original blessing of the Lord was never removed from the other sons. To claim this is to read something into the text that is not there.
So, what should we learn from the blessing and cursing of the sons of Noah? Unfortunately, some have used this passage to teach that the descendants of Japheth have some special right or even calling from God to subdue the people of Ham and rule over them. Nothing of the sort is said in this passage. Not only (as I pointed out) is there no mention of a curse on the sons of Ham that populated Africa, there is also no sort of mandate for any of the descendants of any of these men to act in certain ways toward the others because of their distant ancestor. Also, as the races have continually mixed, people might not have the clear claim to be of one son over the other that they think they have. This passage should never be used to justify the mistreatment of others based on race. Paul stated that God "hath made of one blood all nations of men for to dwell on all the face of the earth" (Acts 17:26). Besides, all that can be found in this prophecy has already been fulfilled and is now history.
Now, back to the question: what can we learn from the sin of Ham and the prophecy that followed? We learn that one act of perversion can create many years of misery and affect many people. We learn that every word of prophecy will be fulfilled and God's words are exact to perfect proportions. We learn that God's word explains the very movements of history. I am sure that we can learn much more. Do not let this prophecy discourage you. It is given so that we might know the destructive power of sin and the predictive power of scripture.